当前位置: 首页>>代码示例>>PHP>>正文


PHP XUtils::bytes_to_string方法代码示例

本文整理汇总了PHP中XUtils::bytes_to_string方法的典型用法代码示例。如果您正苦于以下问题:PHP XUtils::bytes_to_string方法的具体用法?PHP XUtils::bytes_to_string怎么用?PHP XUtils::bytes_to_string使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在XUtils的用法示例。


在下文中一共展示了XUtils::bytes_to_string方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: actionWelcome

 public function actionWelcome()
 {
     cacheFlush();
     $data = array();
     // 系统基本信息
     $serverapi = strtoupper(php_sapi_name());
     $phpversion = PHP_VERSION;
     $systemversion = explode(" ", php_uname());
     $sysReShow = 'none';
     switch (PHP_OS) {
         case "Linux":
             $sysReShow = false !== ($sysInfo = XUtils::sys_linux()) ? "show" : "none";
             $sysinfo = $systemversion[0] . '   ' . $systemversion[2];
             break;
         case "FreeBSD":
             $sysReShow = false !== ($sysInfo = XUtils::sys_freebsd()) ? "show" : "none";
             $sysinfo = $systemversion[0] . '   ' . $systemversion[2];
             break;
         default:
             $sysinfo = $systemversion[0] . '  ' . $systemversion[1] . ' ' . $systemversion[3] . $systemversion[4] . $systemversion[5];
             break;
     }
     if ($sysReShow == 'show') {
         $pmemory = '共' . $sysInfo['memTotal'] . 'M, 已使用' . $sysInfo['memUsed'] . 'M, 空闲' . $sysInfo['memFree'] . 'M, 使用率' . $sysInfo['memPercent'] . '%';
         $pmemorybar = $sysInfo['memPercent'];
         $swapmomory = '共' . $sysInfo['swapTotal'] . 'M, 已使用' . $sysInfo['swapUsed'] . 'M, 空闲' . $sysInfo['swapFree'] . 'M, 使用率' . $sysInfo['swapPercent'] . '%';
         $swapmemorybar = $sysInfo['swapPercent'];
         $syslaodavg = $sysInfo['loadAvg'];
     }
     $mysql = Yii::app()->db->createCommand("SELECT VERSION() AS dbversion")->queryAll();
     $mysql = $mysql[0]['dbversion'];
     $phpsafe = $this->getcon("safe_mode");
     $dispalyerror = $this->getcon("display_errors");
     $allowurlopen = $this->getcon("allow_url_fopen");
     $registerglobal = $this->getcon("register_globals");
     $maxpostsize = $this->getcon("post_max_size");
     $maxupsize = $this->getcon("upload_max_filesize");
     $maxexectime = $this->getcon("max_execution_time") . 's';
     $mqqsp = get_magic_quotes_gpc() === 1 ? 'YES' : 'NO';
     $mprsp = get_magic_quotes_runtime() === 1 ? 'YES' : 'NO';
     $zendoptsp = get_cfg_var("zend_optimizer.optimization_level") || get_cfg_var("zend_extension_manager.optimizer_ts") || get_cfg_var("zend_extension_ts") ? 'YES' : 'NO';
     $iconvsp = XUtils::isfun('iconv');
     $curlsp = XUtils::isfun('curl_init');
     $gdsp = XUtils::isfun('gd_info');
     $zlibsp = XUtils::isfun('gzclose');
     $eaccsp = XUtils::isfun('eaccelerator_info');
     $xcachesp = extension_loaded('XCache') ? 'YES' : 'NO';
     $sessionsp = XUtils::isfun("session_start");
     $cookiesp = isset($_COOKIE) ? 'YES' : 'NO';
     $serverip = @gethostbyname($_SERVER['SERVER_NAME']);
     $serverip = $serverip == '' ? '' : "  ({$serverip})";
     $systime = gmdate("Y年n月j日 H:i:s", time() + 8 * 3600);
     $phpversionsp = $phpversion > '5.0' ? 'YES' : 'NO';
     $mysqlversionsp = $mysql['dbversion'] > '4.1' ? 'YES' : 'NO';
     $dbasp = extension_loaded('dba') ? 'YES' : 'NO';
     // 数据库大小
     $databasesize = 0;
     $rt = Yii::app()->db->createCommand("SHOW TABLE STATUS")->queryAll();
     foreach ($rt as $rsarr) {
         $databasesize += $rsarr['Data_length'] + $rsarr['Index_length'];
     }
     $databasesize = XUtils::bytes_to_string($databasesize);
     //站点统计
     $rt = Yii::app()->db->createCommand("SELECT count(*) as sum FROM {{links}}")->queryAll();
     $sitesum = $rt[0]['sum'];
     $data['serverip'] = $serverip;
     $data['systime'] = $systime;
     $data['sysinfo'] = $sysinfo;
     $data['phpversion'] = $phpversion;
     $data['dbversion'] = $mysql;
     $data['dispalyerror'] = $dispalyerror;
     $data['serverapi'] = $serverapi;
     $data['phpsafe'] = $phpsafe;
     $data['sessionsp'] = $sessionsp;
     $data['cookiesp'] = $cookiesp;
     $data['zendoptsp'] = $zendoptsp;
     $data['eaccsp'] = $eaccsp;
     $data['xcachesp'] = $xcachesp;
     $data['registerglobal'] = $registerglobal;
     $data['mqqsp'] = $mqqsp;
     $data['mprsp'] = $mprsp;
     $data['maxupsize'] = $maxupsize;
     $data['maxpostsize'] = $maxpostsize;
     $data['maxexectime'] = $maxexectime;
     $data['allowurlopen'] = $allowurlopen;
     $data['curlsp'] = $curlsp;
     $data['iconvsp'] = $iconvsp;
     $data['zlibsp'] = $zlibsp;
     $data['gdsp'] = $gdsp;
     $data['dbasp'] = $dbasp;
     $data['datasize'] = $databasesize;
     $data['sitesum'] = $sitesum;
     $tmp = explode('/', dirname($_SERVER['PHP_SELF']));
     $data['safe_notice'] = is_array($tmp) && !empty($tmp[count($tmp) - 1]) && $tmp[count($tmp) - 1] == 'admin' ? 1 : 0;
     //判断admin目录是否存在
     is_dir(SITE_PATH . 'admin/') && ($data['tips']['backend'] = 1);
     //判断install目录是否存在
     is_dir(SITE_PATH . 'install/') && ($data['tips']['install'] = 1);
     $this->render('welcome', array('data' => $data));
 }
开发者ID:lp19851119,项目名称:114la,代码行数:100,代码来源:DefaultController.php


注:本文中的XUtils::bytes_to_string方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。