六月婷婷综合激情-六月婷婷综合-六月婷婷在线观看-六月婷婷在线-亚洲黄色在线网站-亚洲黄色在线观看网站

明輝手游網(wǎng)中心:是一個免費提供流行視頻軟件教程、在線學(xué)習(xí)分享的學(xué)習(xí)平臺!

容易介紹下 PHP5 中引入的 MYSQLI

[摘要]在新下載的PHP5中你會發(fā)現(xiàn)多了一個mysqli.dll,它是干什么用的呢?我簡單介紹下。。。mysqli.dll是PHP對mysql新特性的一個擴(kuò)展支持。在PHP5中可以在php.ini中加載,如...
在新下載的PHP5中你會發(fā)現(xiàn)多了一個mysqli.dll,它是干什么用的呢?我簡單介紹下。。。

mysqli.dll是PHP對mysql新特性的一個擴(kuò)展支持。在PHP5中可以在php.ini中加載,如下圖:




mysql后面的i,指improved, interface, ingenious, incompatible or incomplete(改擴(kuò)展仍在開發(fā)中,因為MYSQL4。1和MYSQL5都沒有正式推出尚在開發(fā)中,新的特性沒有完全實現(xiàn))

mysqli想實現(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è)置高級連接選項

mysqli的使用例子:

1.和以前mysql.dll一樣的方法:

<?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&atilde;o Paulo (9968485)
Shanghai (9696300)
Jakarta (9604900)



2.使用內(nèi)置OO接口方式調(diào)用:

<?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-)





主站蜘蛛池模板: 四虎永久网址影院 | 一二三四在线观看免费高清网 | 丝袜美腿护士办公室在线观看 | 色播亚洲 | 天天看天天摸天天操 | 在线精品91青草国产在线观看 | 综合久久久久久 | 天天射夜夜操 | 天天操天天射天天舔 | 日韩三级免费观看 | 亚洲日本视频在线 | 天天色踪合合 | 日本免费人做人一区在线观看 | 真实国产乱子伦精品一区二区三区 | 日本三级精品 | 我想看一级毛片免费的 | 四虎影剧院 | 亚洲免费福利 | 亚洲日本黄色 | 四虎影院永久在线观看 | 亚洲网站在线免费观看 | 最近手机中文字幕大全首页 | 午夜国产精品免费观看 | 午夜影院普通用户体验区 | 日韩在线视频网 | 完整欧美一级淫片免费看 | 伊人网影院 | 欧美一级啪啪 | 天堂a免费视频在线观看 | 四虎影视在线免费观看 | 在线h观看 | 中文字幕一区二区三区四区五区人 | 日本一区免费在线 | 色花堂国产精品首页第一页 | 亚洲一级片在线播放 | 亚洲第一黄色网址 | 天天综合天天做 | 在线观看亚洲视频 | 人人爽天天爽夜夜爽曰 | 夜夜狠狠狠狠 | 午夜美女视频在线观看高清 |