+
95
-

回答

<?php
$fp = fsockopen('localhost', '80', $errno, $errstr, 5);
var_dump($fp); // returns false
if (!$fp) {
// port is closed or blocked
echo "CLOSED!";
return false;
} else {
// port is open and available
echo "OPEN!";
fclose($fp);
return true;
}

网友回复

我知道答案,我要回答