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
Design and Analysis of Distributed Algorithms (Wiley Series on P
Nicola Santoro / Wiley-Interscience / 2006-10-27 / USD 140.95
This text is based on a simple and fully reactive computational model that allows for intuitive comprehension and logical designs. The principles and techniques presented can be applied to any distrib......一起来看看 《Design and Analysis of Distributed Algorithms (Wiley Series on P》 这本书的介绍吧!