我想知道如何更改代碼以使需求不是來自虛擬主機,而是來自客戶端瀏覽器,在這種情況下顯示相應的客戶端瀏覽器對特定網站/服務器有多少“毫秒”<?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); ?>
來自客戶端瀏覽器的 Ping(延遲)請求,而不是來自虛擬主機
慕尼黑5688855
2022-06-11 10:42:46