Php 端口检查错误?
大家好,我刚让我的端口检查器处理动态映像,但是如果服务器脱机,就会发生错误。有什么帮助吗 它是这样说的: 图像太小: 这就是它应该看起来的样子,但只有在在线时才起作用? 但无论如何,这是我的代码,我不相信这是一个代码问题,也许我的网络主机是hostgatorPhp 端口检查错误?,php,port,Php,Port,大家好,我刚让我的端口检查器处理动态映像,但是如果服务器脱机,就会发生错误。有什么帮助吗 它是这样说的: 图像太小: 这就是它应该看起来的样子,但只有在在线时才起作用? 但无论如何,这是我的代码,我不相信这是一个代码问题,也许我的网络主机是hostgator <?php $ip = $_GET["ip"]; $port = $_GET["port"]; $online = "Online"; $offline = "Offline";
<?php
$ip = $_GET["ip"];
$port = $_GET["port"];
$online = "Online";
$offline = "Offline";
$status = fsockopen($ip, $port) ? $online : $offline;
// Create a blank image and add some text
$im = imagecreatetruecolor(215, 86);
$text_color = imagecolorallocate($im, 233, 14, 91);
// sets background to Light Blue
$LightBlue = imagecolorallocate($im, 95, 172, 230);
imagefill($im, 0, 0, $LightBlue);
//Server Information
imagestring($im, 7, 5, 5, '3Nerds1Site.com', $text_color);
imagestring($im, 2, 40, 30, $ip, $text_color);
imagestring($im, 2, 40, 40, $port, $text_color);
imagestring($im, 2, 40, 70, $status, $text_color);
// Set the content type header - in this case image/jpeg
header('Content-Type: image/png');
// Output the image
imagepng($im);
// Free up memory
imagedestroy($im);
?>
$status = (fsockopen($ip, $port));
致:
@
会在您执行此类荒谬操作时抑制错误消息错误报告(0)关闭错误报告代码>
ooops几乎忘记了代码已更新。if-else语句是否更改为$status=fsockopen($ip,$port)$在线:离线;谢谢,它可以工作:0,还有另一个问题,我尝试粘贴到代码块,但出于某种原因,它只得到我的第一行?
$status = (@fsockopen($ip, $port));