本文介紹了新的 mysqli 與 mysqli_connect的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
新的mysqli
和mysqli_connect
有什么區別?我知道執行查詢是不同的;
例如:mysqli->query()
和 mysqli_query()
為什么是兩種不同的類型,有什么需要區別的?
What is difference between the new mysqli
and mysqli_connect
?
I know that executing a query is different;
for example: mysqli->query()
and mysqli_query()
Why are there two different types, what is the need for the difference?
推薦答案
一個用于過程式編程,另一個用于 OOP 式編程.兩者都有相同的目的;打開一個到 MySQL 服務器的新連接
One is for Procedural style programming and other is for OOP style programming. Both serve the same purpose; Open a new connection to the MySQL server
OOP 樣式用法
$mysqli = new mysqli('localhost', 'my_user', 'my_password', 'my_db');
程序風格的使用
$link = mysqli_connect('localhost', 'my_user', 'my_password', 'my_db');
參考:PHP手冊
這篇關于新的 mysqli 與 mysqli_connect的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!