本文整理匯總了PHP中dir::size方法的典型用法代碼示例。如果您正苦於以下問題:PHP dir::size方法的具體用法?PHP dir::size怎麽用?PHP dir::size使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類dir
的用法示例。
在下文中一共展示了dir::size方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testSize
public function testSize()
{
dir::make($this->tmpDir);
f::write($this->tmpDir . DS . 'testfile-1.txt', str::random(5));
f::write($this->tmpDir . DS . 'testfile-2.txt', str::random(5));
f::write($this->tmpDir . DS . 'testfile-3.txt', str::random(5));
$this->assertEquals(15, dir::size($this->tmpDir));
$this->assertEquals('15 b', dir::niceSize($this->tmpDir));
dir::remove($this->tmpDir);
}
示例2: size
public static function size($dir)
{
$handle = @opendir($dir);
$size = 0;
while (false !== ($f = readdir($handle))) {
if ($f != "." && $f != "..") {
if (is_dir("{$dir}/{$f}")) {
$size += dir::size("{$dir}/{$f}");
} else {
$size += filesize("{$dir}/{$f}");
}
}
}
@closedir($handle);
return $size;
}
示例3: onSystem
public function onSystem()
{
$header['title'] = '控製中心';
$phpinfo = array();
$server = $_SERVER['SERVER_ADDR'] . ' / ' . PHP_OS;
$php = $_SERVER['SERVER_SOFTWARE'];
$safemode = @ini_get('safe_mode') ? ' 開啟' : '關閉';
if (@ini_get('file_uploads')) {
$upload_max_filesize = ini_get('upload_max_filesize');
} else {
$upload_max_filesize = '<b class="red">---</b>';
}
$upload_filesize = format::byte(dir::size(ZOTOP_UPLOAD));
$database = zotop::db()->config();
$database['size'] = zotop::db()->size();
$database['version'] = zotop::db()->version();
$database['db'] = $database['hostname'] . ':' . $database['hostport'] . '/' . $database['database'];
page::header($header);
page::top();
page::navbar($this->navbar());
block::header('服務器信息');
table::header();
table::row(array('side 1 w60' => '服務器', 'main w300 1' => $server, 'side 2 w60 ' => 'WEB服務器', 'main 2' => $php));
table::row(array('side 1 w60' => '安全模式', 'main 1' => $safemode, 'side 2 w60 ' => 'PHP版本', 'main 2' => PHP_VERSION));
table::row(array('side 1 w60' => '程序版本', 'main 1' => zotop::config('zotop.version'), 'side 2 w60 ' => '程序根目錄', 'main 2' => ROOT));
table::footer();
block::footer();
block::header('文件夾權限<span>如果某個文件或目錄被檢查到“無法寫入”(以紅色列出),請即刻通過 FTP 或其他工具修改其屬性(例如設置為 777),以確保程序功能的正常使用</span>');
table::header();
table::row(array('side 1 w60' => '配置目錄', 'main w300 1' => '', 'side 2 w60 ' => '備份目錄', 'main 2' => ''));
table::row(array('side 1 w60' => '運行目錄', 'main w300 1' => '', 'side 2 w60 ' => '模塊目錄', 'main 2' => ''));
table::footer();
block::footer();
block::header('數據庫信息');
table::header();
table::row(array('side 1 w60' => '驅動名稱', 'main w300 1' => $database['driver'], 'side 2 w60 ' => '數據庫', 'main 2' => $database['db']));
table::row(array('side 1 w60' => '數據庫版本', 'main 1' => $database['version'], 'side 2 w60 ' => '占用空間', 'main 2' => $database['size']));
table::footer();
block::footer();
block::header('文件上傳');
table::header();
table::row(array('side 1 w60' => '上傳許可', 'main w300 1' => $upload_max_filesize, 'side 2 w60 ' => '已上傳文件', 'main 2' => '<span class="loading">' . $upload_filesize . '</span>'));
table::footer();
block::footer();
page::bottom();
page::footer();
}