PHP mysqli_ping() 函数
PHP 教程
· 2019-01-28 10:12:37
检测服务器连接:
<?php
// 假定数据库用户名:root,密码:123456,数据库:CODERCTO
$con=mysqli_connect("localhost","root","123456","CODERCTO");
if (mysqli_connect_errno($con))
{
echo "连接 MySQL 失败: " . mysqli_connect_error();
}
// 检测 MySQL 服务器是否可用
if (mysqli_ping($con))
{
echo "连接正常!";
}
else
{
echo "错误: ". mysqli_error($con);
}
mysqli_close($con);
?>
定义和用法
mysqli_ping() 函数进行一个服务器连接,如果连接已断开则尝试重新连接。
语法
mysqli_ping(connection);
| 参数 | 描述 |
|---|---|
| connection | 必需。规定要使用的 MySQL 连接。 |
技术细节
| 返回值: | 如果成功则返回 TRUE,如果失败则返回 FALSE。 |
|---|---|
| PHP 版本: | 5+ |
点击查看所有 PHP 教程 文章: https://codercto.com/courses/l/5.html
Domain-Driven Design
Eric Evans / Addison-Wesley Professional / 2003-8-30 / USD 74.99
"Eric Evans has written a fantastic book on how you can make the design of your software match your mental model of the problem domain you are addressing. "His book is very compatible with XP. It is n......一起来看看 《Domain-Driven Design》 这本书的介绍吧!