Home > Database > Mysql Tutorial > body text

mysql_pconnect()_MySQL

WBOY
Release: 2016-06-01 13:48:28
Original
1209 people have browsed it

bitsCN.com

教材上说,mysql_pconnect() 是长连接,数据库脚本执行完毕后,该链接也不会关闭,但为什么我的代码显示这个链接号已经变了呢?代码如下:function isAuthentic ($_userId,$_password){   echo "isAuthentic start!<p>";  $conn = mysql_pconnect(DBHost,DBUser,DBPassword);  echo "conn=".$conn."<br>";}function getStaffInfo (StaffInfo &$_POST,$ID) {      $conn = mysql_pconnect(DBHost,DBUser,DBPassword);    echo "conn123 =".$conn."<br>";}我调用这两个方法isAuthentic();getStaffinfo();打印的结果为:isAuthentic start!conn=Resource id #4Authentic is OK.conn123 =Resource id #6为什么一个是4,一个是6呢? 如果是长连接,第二个不会去建立一个新的连接啊。。。请高手解答。谢谢。</p>
Copy after login

问题补充:

那调用了mysql_pconnect()后, 需要关闭数据库连接吗?比如调用mysql_close(). 还是永久都不需要关闭数据库连接? 谢谢。
Copy after login

 

bitsCN.com
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!