本文整理汇总了PHP中zmf::formatBytes方法的典型用法代码示例。如果您正苦于以下问题:PHP zmf::formatBytes方法的具体用法?PHP zmf::formatBytes怎么用?PHP zmf::formatBytes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类zmf
的用法示例。
在下文中一共展示了zmf::formatBytes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: jsConfig
/**
* 加载js路径配置文件
* @param type $type 应用类型
*/
public function jsConfig($type = 'web', $module = 'web')
{
$arr['common'] = array('baseUrl' => zmf::config('baseurl'), 'hasLogin' => Yii::app()->user->isGuest ? 'false' : 'true', 'loginUrl' => Yii::app()->createUrl('/site/login'), 'module' => $module, 'csrfToken' => Yii::app()->request->csrfToken, 'currentSessionId' => Yii::app()->session->sessionID, 'addCommentUrl' => zmf::config('domain') . Yii::app()->createUrl('/ajax/addComment'));
$arr['web'] = array('editor' => '', 'allowImgTypes' => zmf::config('imgAllowTypes'), 'allowImgPerSize' => zmf::formatBytes(zmf::config('imgMaxSize')), 'perAddImgNum' => zmf::config('imgUploadNum'), 'weiboAppkey' => zmf::config('weiboAppkey'), 'weiboRalateUid' => zmf::config('weiboRalateUid'), 'contentsUrl' => zmf::config('domain') . Yii::app()->createUrl('/ajax/getContents'), 'delContentUrl' => zmf::config('domain') . Yii::app()->createUrl('/ajax/delContent'), 'favoriteUrl' => zmf::config('domain') . Yii::app()->createUrl('/ajax/favorite'), 'feedbackUrl' => zmf::config('domain') . Yii::app()->createUrl('/ajax/feedback'), 'setStatusUrl' => zmf::config('domain') . Yii::app()->createUrl('/ajax/setStatus'));
$arr['mobile'] = array('contentsUrl' => zmf::config('domain') . Yii::app()->createUrl('/ajax/getContents'), 'delContentUrl' => zmf::config('domain') . Yii::app()->createUrl('/ajax/delContent'), 'favoriteUrl' => zmf::config('domain') . Yii::app()->createUrl('/ajax/favorite'));
$attrs = array_merge($arr['common'], $arr[$type]);
$longHtml = '<script>var zmf={';
foreach ($attrs as $k => $v) {
$longHtml .= $k . ":'" . $v . "',";
}
$longHtml .= '};</script>';
echo $longHtml;
}
示例2: actionIndex
public function actionIndex()
{
$arr['serverSoft'] = $_SERVER['SERVER_SOFTWARE'];
$arr['serverOS'] = PHP_OS;
$arr['PHPVersion'] = PHP_VERSION;
$arr['fileupload'] = ini_get('file_uploads') ? ini_get('upload_max_filesize') : '禁止上传';
$dbsize = 0;
$connection = Yii::app()->db;
$sql = 'SHOW TABLE STATUS LIKE \'' . $connection->tablePrefix . '%\'';
$command = $connection->createCommand($sql)->queryAll();
foreach ($command as $table) {
$dbsize += $table['Data_length'] + $table['Index_length'];
}
$mysqlVersion = $connection->createCommand("SELECT version() AS version")->queryAll();
$arr['mysqlVersion'] = $mysqlVersion[0]['version'];
$arr['dbsize'] = $dbsize ? zmf::formatBytes($dbsize) : '未知';
$arr['serverUri'] = $_SERVER['SERVER_NAME'];
$arr['maxExcuteTime'] = ini_get('max_execution_time') . ' 秒';
$arr['maxExcuteMemory'] = ini_get('memory_limit');
$arr['excuteUseMemory'] = function_exists('memory_get_usage') ? zmf::formatBytes(memory_get_usage()) : '未知';
$this->render('index', array('siteinfo' => $arr));
}