首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >多个IP的服务器联机/脱机脚本

多个IP的服务器联机/脱机脚本
EN

Stack Overflow用户
提问于 2016-07-19 21:44:52
回答 0查看 2K关注 0票数 0

我只是在寻找php脚本检查服务器在线或OFfline为我的网站..在一个论坛上,我发现了以下脚本:

代码语言:javascript
复制
<?php
    /* our simple php ping function */
    function ping($host)
    {
            exec(sprintf('ping -c 1 -W 5 %s', escapeshellarg($host)), $res, $rval);
            return $rval === 0;
    }

    /* check if the host is up
            $host can also be an ip address */
    $host = 'XX.XX.XX.XX';
    $up = ping($host);

    /* optionally display either a red or green image to signify the server status */
    if ($up) {
    echo 'Online';
} else {
    echo 'Offline';
}
    ?>

我只想知道如何在同一脚本中ping多个IP?另外如何添加在线自柜台...?提前谢谢..

EN

回答

页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/38460404

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档