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

簡單介紹下 PHP5 中引入的 MYSQLI的用途

在新下載的php5中你會發(fā)現(xiàn)多了一個mysqli.dll,它是干什么用的呢?我簡單介紹下。。。
mysqli.dll是php對mysql新特性的一個擴(kuò)展支持。在php5中可以在php.ini中加載.
mysql后面的i,指improved, interface, ingenious, incompatible or incomplete(改擴(kuò)展仍在開發(fā)中,因?yàn)镸YSQL4。1和MYSQL5都沒有正式推出尚在開發(fā)中,新的特性沒有完全實(shí)現(xiàn))
mysqli想實(shí)現(xiàn)的目標(biāo)具體有:
-更簡單的維護(hù)
-更好的兼容性
-向后兼容
mysql(指php中的模塊)發(fā)展到現(xiàn)在顯得比較凌亂,有必要重新做下整理。同時,有必要跟上MYSQL(DBMS)的發(fā)展步伐,加入新的特性的支持,以及適應(yīng)MYSQL(DBMS)以后的版本。所以誕生了mysqli.dll
mysqli.dll的特性:
-可以和mysql.dll一樣的方式使用
-支持OO接口,簡簡單單調(diào)用
-支持MYSQL4。1引入的新特性
-通過mysqli_init() 等相關(guān)函數(shù),可以設(shè)置高級連接選項(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
注:感覺這個不是對所有人都有用。不過。。。相信可以幫助大家多了解些“變化”,能更好的把握“趨勢” 8-) 

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

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

主站蜘蛛池模板: 日日插夜夜操 | 涩涩涩涩涩涩涩涩涩涩 | 欧美一区二区三区gg高清影视 | 蕾丝视频福利网站 | 人人干人| 黄色网址免费在线播放 | 综合婷婷| 欧美特黄a级高清免费看片 欧美特黄a级片 | 2021国产精品 | 女人的天堂网 | 国产亚洲精品2021自在线 | 精品视频一二三区 | 九九99久久精品影视 | 亚洲精品图区 | 久久久久久亚洲精品不卡 | 国产成人精品日本亚洲直接 | 日本欧美一区二区三区视频麻豆 | 色在线综合 | 亚洲福利一区二区 | 午夜视频一区 | 韩国欧洲一级毛片免费 | 四虎sihu新版影院亚洲精品 | 欧美一级艳片爽快片 | 影音先锋 色天使 | 久久99草 | 五月婷婷在线视频 | 亚洲国产一区视频 | 久久er99热精品一区二区 | 成人年鲁鲁在线观看视频 | 国产视频播放 | 国产福利在线免费 | 香蕉97碰碰视频免费 | 久久精品国产精品青草不卡 | 高清国产欧美一v精品 | 午夜免费视频观看 | 免费一区二区三区在线视频 | 国产精品合集一区二区三区 | 久久青草社区 | 国产成人在线小视频 | 四虎在线最新地址4hu | 国色天香精品亚洲精品 |