简单实用的获取服务器信息

浏览:6357 发布日期:2014/11/04 分类:技术分享 关键字: 获取服务器信息 服务器信息
之前有好几个人都发了有关获取服务器信息的帖子,可是无图无真相!我特意也写了一串代码,用户获取服务器常用的信息,截图如下:

后台php代码:$info = array(
            '操作系统'=>PHP_OS,
            '运行环境'=>$_SERVER["SERVER_SOFTWARE"],
            '主机名'=>$_SERVER['SERVER_NAME'],
            'WEB服务端口'=>$_SERVER['SERVER_PORT'],
            '网站文档目录'=>$_SERVER["DOCUMENT_ROOT"],
            '浏览器信息'=>substr($_SERVER['HTTP_USER_AGENT'], 0, 40),
            '通信协议'=>$_SERVER['SERVER_PROTOCOL'],
            '请求方法'=>$_SERVER['REQUEST_METHOD'],
            'ThinkPHP版本'=>THINK_VERSION,
            '上传附件限制'=>ini_get('upload_max_filesize'),
            '执行时间限制'=>ini_get('max_execution_time').'秒',
            '服务器时间'=>date("Y年n月j日 H:i:s"),
            '北京时间'=>gmdate("Y年n月j日 H:i:s",time()+8*3600),
            '服务器域名/IP'=>$_SERVER['SERVER_NAME'].' [ '.gethostbyname($_SERVER['SERVER_NAME']).' ]',
            '用户的IP地址'=>$_SERVER['REMOTE_ADDR'],
            '剩余空间'=>round((disk_free_space(".")/(1024*1024)),2).'M',
        );
        $this->info=$info;
前台模板代码: <div class="row">
                <div class="col-md-6">
                    <div class="panel panel-archon">
                        <div class="panel-heading">
                            <h3 class="panel-title">服务器信息
                                <span class="pull-right">
                                    <a  href="#" class="panel-minimize"><i class="icon-chevron-up"></i></a>
                                    <a  href="#"  class="panel-settings"><i class="icon-cog"></i></a>
                                    <a  href="#"  class="panel-close"><i class="icon-remove"></i></a>
                                </span>
                            </h3>
                        </div>
                        <div class="panel-body">
                            <table class="table table-bordered">
                                <thead>
                                    <tr>
                                        <th>名称</th>
                                        <th>参数</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <volist name="info" id="v">
                                    <tr>
                                        <td>{$key}</td>
                                        <td>{$v}</td>
                                    </tr>
                                    </volist>
                                </tbody>
                            </table>                            
                        </div>
                    </div>
                </div>
最佳答案
评论( 相关
后面还有条评论,点击查看>>