Home >Backend Development >PHP Tutorial >mysqli的联接与操作分离

mysqli的联接与操作分离

WBOY
WBOYOriginal
2016-06-13 12:19:16835browse

mysqli的连接与操作分离
我在这页面已经写好数据库连接:

然后在其他页面上:include 'mysql_connect.php';
能封装好mysql_connect呢?
然后怎么用mysqli_query来操作呢?不想每次都用 global。
------解决思路----------------------
封装啊!
可以封成一个函数
也可以封装成一个类

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn