控制器代码:
<?php public function index() { $info = array( '操作系统'=>PHP_OS, '运行环境'=>$_SERVER["SERVER_SOFTWARE"], 'PHP运行方式'=>php_sapi_name(), 'PHP版本'=>PHP_VERSION, '数据库版本' => $this->_mysql_version(), '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']).' ]', 'register_globals'=>get_cfg_var("register_globals")=="1" ? "ON" : "OFF", 'magic_quotes_gpc'=>(1===get_magic_quotes_gpc())?'YES':'NO', 'magic_quotes_runtime'=>(1===get_magic_quotes_runtime())?'YES':'NO', ); $this->assign('info',$info); return $this->fetch(); } ?>
获取数据库信息:
<?php private function _mysql_version() { // $Model = self::_model(); $version = \think\Db::query("select version() as ver"); return $version[0]['ver']; } ?>
模板文件:
<div class="col-xs-6"> <div class="content-box column-left"> <div class="content-box-header"> h3>系统信息</h3> </div> !-- End .content-box-header --> <div class="content-box-content"> <div class="tab-content default-tab"> <p> <table> {volist name="info" id="v"} <tr> <td >{$key}:</td> <td class="input">{$v}</td> </tr> {/volist} </table> </p> </div> <!-- End #tab3 --> </div> <!-- End .content-box-content --> </div> </div>
文章评论(0)