成人精品一区二区三区中文字幕-成人精品一区二区三区-成人精品一级毛片-成人精品亚洲-日本在线视频一区二区-日本在线视频免费

導航首頁 ? 技術教程 ? 簡單介紹下 PHP5 中引入的 MYSQLI的用途
全站頭部文字 我要出現在這里
簡單介紹下 PHP5 中引入的 MYSQLI的用途 757 2023-12-09   

在新下載的PHP5中你會發現多了一個mysqli.dll,它是干什么用的呢?我簡單介紹下。。。
mysqli.dll是PHP對mysql新特性的一個擴展支持。在PHP5中可以在php.ini中加載.
mysql后面的i,指improved, interface, ingenious, incompatible or incomplete(改擴展仍在開發中,因為MYSQL4。1和MYSQL5都沒有正式推出尚在開發中,新的特性沒有完全實現)
mysqli想實現的目標具體有:
-更簡單的維護
-更好的兼容性
-向后兼容
mysql(指PHP中的模塊)發展到現在顯得比較凌亂,有必要重新做下整理。同時,有必要跟上MYSQL(DBMS)的發展步伐,加入新的特性的支持,以及適應MYSQL(DBMS)以后的版本。所以誕生了mysqli.dll
mysqli.dll的特性:
-可以和mysql.dll一樣的方式使用
-支持OO接口,簡簡單單調用
-支持MYSQL4。1引入的新特性
-通過mysqli_init() 等相關函數,可以設置高級連接選項
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);
?>

輸出結果:
Very large cities are:
Mumbai (Bombay) (10500000)
Seoul (9981619)
São Paulo (9968485)
Shanghai (9696300)
Jakarta (9604900)
2.使用內置OO接口方式調用:

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

主站蜘蛛池模板: 电视剧一帘幽梦| 因鬼六罪恶六芒星| 超级飞侠十七季| 影音先锋欧美| 湖南卫视节目表今天| 伦理<禁忌1| 小小少年电影简介| 小镇追凶电影免费观看| 同志电影副歌1080p| 百岁宫简介| 禁忌爱游戏| 肮脏性感的人| 吃什么皮肤白的最快| 血芙蓉电影| 凌晨晚餐| 55天在北京| 美式壁纸| 新藤惠美| 玉匣记全文免费| 钱月笙| 布莱德·德尔森| 诺拉·阿娜泽德尔| 从此以后歌词| www.五月天| 美女绳奴隶| 西班牙女郎| 四大名著好词好句摘抄| 乔什布洛林| 视频污| 雷恪生个人资料简介| 因鬼六罪恶六芒星| 美女亲热视频| 韩国xxxxxxxxxxxx| 龙的传人第四季| 少年包青天4第四部| 丰满视频| 美女写真库| 掐脖子自制短视频| 吉泽明步电影| 日韩欧美动作影片| 童年吉他谱原版c调|

?。?!站長長期在線接?。。?/p>

網站、小程序:定制開發/二次開發/仿制開發等

各種疑難雜癥解決/定制接口/定制采集等

站長微信:lxwl520520

站長QQ:1737366103