我想知道如何更改代码以使需求不是来自虚拟主机,而是来自客户端浏览器,在这种情况下显示相应的客户端浏览器对特定网站/服务器有多少“毫秒”
<?
function ping($host, $port, $timeout) {
$tB = microtime(true);
$fP = fSockOpen($host, $port, $errno, $errstr, $timeout);
if (!$fP) { return "Server is down"; }
$tA = microtime(true);
return round((($tA - $tB) * 1000), 0)." ms";
}
//Echoing it will display the ping if the host is up, if not it'll say "down".
echo ping("google.com", 80, 10);
?>
慕田峪4524236