• php获取服务器和mysql等信息输出到页面(基于ci框架)


    function show($varName) {
        switch($result = get_cfg_var($varName)) {
         case 0:
          return '<font color="red">不支持</font>';
          break;
         case 1:
          return '支持';
          break;
         default:
          return $result;
          break;
        }
       }

                 $rows=array();
                 //服务器所有信息
                 //$rows[0]=$_SERVER['SERVER_SOFTWARE'];//获取操作系统软件信息
           $rows['s0']=$_SERVER['SERVER_NAME'];//服务器名称
           $rows['s1']=gethostbyname($_SERVER['SERVER_NAME']);//服务器的ip
           $rows['s2']=gmdate("Y年n月j日 H:i:s",time()+8*3600);//服务器时间
           $rows['s3']=$_SERVER['SERVER_PORT'];//服务器端口
           //PHP相关参数
           $rows['p0']=PHP_VERSION;//PHP版本
           $rows['p1']=strtoupper(php_sapi_name());//PHP运行方式
           $rows['p2']=show("upload_max_filesize");//上传文件最大限制
           $rows['p3']=show("post_max_size");//POST方法提交最大限制
           $rows['p4']=show("memory_limit");//脚本超时时间
                 //mysql相关参数
                 $c=$this->db->query("select sum(DATA_LENGTH)+sum(INDEX_LENGTH) as num from `information_schema`.`tables` where table_schema='li_cms'");
                 $rowc=$c->result();

                   $rowsc=intval($rowc[0]->num)/1024/1024;//数据库及大小
                 if(intval($rowsc)<1){
                   $rows['m1']=intval($rowc[0]->num)/1024;
                   $rows['m1']=number_format($rows['m1'],2,'.','').'<FONT COLOR=BLUE> KB</FONT>';
                   }
                 else {
                  $rows['m1']= number_format($rowsc,2,'.','').'<FONT COLOR=BLUE> M</FONT>';
                  }
                 $rows['m0']=@mysql_get_server_info();//获取mysql版本信息
                $this->load->view("manage/station",$rows);//加载到模板

  • 相关阅读:
    RESTful规范1
    Django -- 发送HTML格式的邮件
    11.10 vue
    Selenium 使用
    Beautiful Soup的用法
    Pthon常用模块之requests,urllib和re
    爬虫--工具安装Jupyter anaconda
    11-3
    Python -- tabulate 模块,
    Python -- queue队列模块
  • 原文地址:https://www.cnblogs.com/legend-song/p/3454179.html
Copyright © 2020-2023  润新知