如何使用 PHP ping 服务器端口?
我想要一个PHP脚本,它允许您ping一个IP地址和一个端口号()。我找到了一个类似的脚本,但它仅适用于网站,而不适用于.ip:portip:port
<?php
function ping($host, $port, $timeout) 
{ 
  $tB = microtime(true); 
  $fP = fSockOpen($host, $port, $errno, $errstr, $timeout); 
  if (!$fP) { return "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("www.google.com", 80, 10);
?>
我想要这个游戏服务器。
这个想法是我可以输入IP地址和端口号,然后我得到ping响应。