本文整理匯總了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));
}