mysql_pconnect说法错误的是_mysql_pconnect() 和 mysql_connect()区别,结果和手册讲得正好相反?是我理解错了?...

mysql_pconnect()和mysql_connect()非常相似,但有两个主要区别定义和用法mysql_pconnect()函数打开一个到MySQL服务器的持久连接。mysql_pconnect()和mysql_connect()非常相似,但有两...

mysql_pconnect() 和 mysql_connect() 非常相似,但有两个主要区别

定义和用法

mysql_pconnect() 函数打开一个到 MySQL 服务器的持久连接。

mysql_pconnect() 和 mysql_connect() 非常相似,但有两个主要区别:

当连接的时候本函数将先尝试寻找一个在同一个主机上用同样的用户名和密码已经打开的(持久)连接,如果找到,则返回此连接标识而不打开新连接。

其次,当脚本执行完毕后到 SQL 服务器的连接不会被关闭,此连接将保持打开以备以后使用(mysql_close() 不会关闭由 mysql_pconnect() 建立的连接)。

$con = mysql_pconnect("localhost", "root", "");

echo $con;

echo "
";

$con = mysql_pconnect("localhost", "root", "");

echo $con;

echo "
";

$con = mysql_pconnect("localhost", "root", "");

echo $con;

echo "
";

$con = mysql_connect("localhost", "root", "");

echo $con;

echo "
";

$con = mysql_connect("localhost", "root", "");

echo $con;

echo "
";

$con = mysql_connect("localhost", "root", "");

echo $con;

echo "
";

$con = mysql_pconnect("localhost", "root", "");

echo $con;

echo "
";

$con = mysql_pconnect("localhost", "root", "");

echo $con;

echo "
";

$con = mysql_pconnect("localhost", "root", "");

echo $con;

echo "
";

$con = mysql_pconnect("localhost", "root", "");

echo $con;

echo "
";

$con = mysql_connect("localhost", "root", "");

echo $con;

echo "
";

$con = mysql_connect("localhost", "root", "");

echo $con;

echo "
";

$con = mysql_connect("localhost", "root", "");

echo $con;

?>

Resource id #2

Resource id #3

Resource id #4

Resource id #5

Resource id #5

Resource id #5

Resource id #6

Resource id #7

Resource id #8

Resource id #9

Resource id #10

Resource id #10

Resource id #10

为什么结果和手册讲得正好相反?是我理解错了?请赐教

展开

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值