根据官方文档:Checks whether the connection to the server is working. If the connection has gone down and auto-reconnect is enabled an attempt to reconnect is made. If the connection is down and auto-reconnect is disabled, mysql_ping() returns an error.也就是说,如果 MYSQL_OPT_RECONNECT 没有被设置为 1(开启),那么mysql_ping()不会完成自动重连,只是简单返回一个error。那么如果已经开启这个选项了呢?官方文档又说了:MYSQL_OPT_RECONNECT (argument type: my_bool *)Enable or disable automatic reconnection to the server if the connection is found to have been lost.也就是说,如果发现连接断开,那么会启动自动重连功能。现在问题是:连接断开这事儿是啥时候被发现的呢?根据官方文档mysql_ping()肯定是会发现,那mysql_query()是否会"发现"呢?
添加回答
举报
0/150
提交
取消