时间:2021-07-01 10:21:17 帮助过:7人阅读
html部分代码:
PHP+Ajax实时自动检测是否联网 PHP+Ajax实时自动检测是否联网
当前网络状态:
php部分代码:
public function getNetLink(){
header("cache-control:no-cache,must-revalidate");
header("Content-Type:text/html;charset=utf-8");
$file=fopen("http://www.baidu.com/", "r");
if (!$file){
$shownetlink = "网络连接失败";
}else{
$shownetlink = "网络连接正常";
}
echo $shownetlink;
}
希望本文所述对大家的php程序设计有所帮助。