一区二区久久-一区二区三区www-一区二区三区久久-一区二区三区久久精品-麻豆国产一区二区在线观看-麻豆国产视频

簡(jiǎn)單介紹下 PHP5 中引入的 MYSQLI的用途

在新下載的php5中你會(huì)發(fā)現(xiàn)多了一個(gè)mysqli.dll,它是干什么用的呢?我簡(jiǎn)單介紹下。。。
mysqli.dll是php對(duì)mysql新特性的一個(gè)擴(kuò)展支持。在php5中可以在php.ini中加載.
mysql后面的i,指improved, interface, ingenious, incompatible or incomplete(改擴(kuò)展仍在開(kāi)發(fā)中,因?yàn)镸YSQL4。1和MYSQL5都沒(méi)有正式推出尚在開(kāi)發(fā)中,新的特性沒(méi)有完全實(shí)現(xiàn))
mysqli想實(shí)現(xiàn)的目標(biāo)具體有:
-更簡(jiǎn)單的維護(hù)
-更好的兼容性
-向后兼容
mysql(指php中的模塊)發(fā)展到現(xiàn)在顯得比較凌亂,有必要重新做下整理。同時(shí),有必要跟上MYSQL(DBMS)的發(fā)展步伐,加入新的特性的支持,以及適應(yīng)MYSQL(DBMS)以后的版本。所以誕生了mysqli.dll
mysqli.dll的特性:
-可以和mysql.dll一樣的方式使用
-支持OO接口,簡(jiǎn)簡(jiǎn)單單調(diào)用
-支持MYSQL4。1引入的新特性
-通過(guò)mysqli_init() 等相關(guān)函數(shù),可以設(shè)置高級(jí)連接選項(xiàng)
mysqli的使用例子:
1.和以前mysql.dll一樣的方法:
復(fù)制代碼 代碼如下:
<?php 
/* Connect to a MySQL server */  
$link = mysqli_connect(  
           'localhost',  /* The host to connect to */  
           'user',       /* The user to connect as */  
           'password',   /* The password to use */  
           'world');     /* The default table to query */ 
if (!$link) {  
  printf("Can't connect to MySQL Server. Errorcode: %sn", mysqli_connect_error());  
  exit;  

/* Send a query to the server */  
if ($result = mysqli_query($link, 'SELECT Name, Population FROM City ORDER BY Population DESC LIMIT 5')) { 
print("Very large cities are:n"); 
/* Fetch the results of the query */  
   while( $row = mysqli_fetch_assoc($result) ){  
       printf("%s (%s)n", $row['Name'], $row['Population']);  
   } 
/* Destroy the result set and free the memory used for it */  
   mysqli_free_result($result);  

/* Close the connection */  
mysqli_close($link);  
?>  

輸出結(jié)果:
Very large cities are:
Mumbai (Bombay) (10500000)
Seoul (9981619)
São Paulo (9968485)
Shanghai (9696300)
Jakarta (9604900)
2.使用內(nèi)置OO接口方式調(diào)用:
復(fù)制代碼 代碼如下:
<?php 
/* Connect to a MySQL server */  
$mysqli = new mysqli('localhost', 'user', 'password', 'world'); 
if (mysqli_connect_errno()) {  
  printf("Can't connect to MySQL Server. Errorcode: %sn", mysqli_connect_error());  
  exit;  

/* Send a query to the server */  
if ($result = $mysqli->query('SELECT Name, Population FROM City ORDER BY Population DESC LIMIT 5')) { 
print("Very large cities are:n"); 
/* Fetch the results of the query */  
   while( $row = $result->fetch_assoc() ){  
       printf("%s (%s)n", $row['Name'], $row['Population']);  
   } 
/* Destroy the result set and free the memory used for it */  
   $result->close();  

/* Close the connection */  
$mysqli->close();  
?>  

支持的新特性還有:Bound Parameters,Bound Results等。。。
有興趣的可以直接去參看原英文:
http://www.zend.com/php5/articles/php5-mysqli.php#fn3
注:感覺(jué)這個(gè)不是對(duì)所有人都有用。不過(guò)。。。相信可以幫助大家多了解些“變化”,能更好的把握“趨勢(shì)” 8-) 

php技術(shù)簡(jiǎn)單介紹下 PHP5 中引入的 MYSQLI的用途,轉(zhuǎn)載需保留來(lái)源!

鄭重聲明:本文版權(quán)歸原作者所有,轉(zhuǎn)載文章僅為傳播更多信息之目的,如作者信息標(biāo)記有誤,請(qǐng)第一時(shí)間聯(lián)系我們修改或刪除,多謝。

主站蜘蛛池模板: 色综合天天综合高清网国产 | 午夜在线播放视频 | 欧美人xxxx另类 | 久久国产加勒比精品无码 | 国产一区二区网站 | 在线资源观看 | 成人在线a | 国产中文字幕视频在线观看 | 99九九精品免费视频观看 | 久草视频手机在线观看 | 伊人久久婷婷 | 成人亚洲网站 | 日本无吗免费一二区 | 天天躁日日躁aaaaxxxx | 国产成人午夜性a一级毛片 国产成人系列 | 真实国产乱弄免费视频 | 思思99精品国产自在现线 | 亚洲福利一区二区 | 激情网成人 | 五月综合在线 | 成人精品视频一区二区三区 | 奇米影视四色7777久久精品 | 五月婷婷综合在线 | 综合激情五月婷婷 | 日本精品视频一区二区三区 | 91精品视频在线 | 欧美国产综合在线 | 亚洲三级自拍 | 伊人婷婷 | 国产真实伦实例 | 色啪视频 | 99视频国产精品 | www视频免费 | 日本一区二区三区高清在线观看 | 国产午夜在线观看视频播放 | 国产精品日本不卡一区二区 | 国产在线精彩视频 | 午夜黄色 | 欧美激情小视频 | 99国产精品视频免费观看 | 91精品国产91久久久久久麻豆 |