本文整理匯總了PHP中format::size方法的典型用法代碼示例。如果您正苦於以下問題:PHP format::size方法的具體用法?PHP format::size怎麽用?PHP format::size使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類format
的用法示例。
在下文中一共展示了format::size方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: onDefault
public function onDefault()
{
$tables = $this->db->table()->get(true);
$header['title'] = '數據庫管理';
page::header($header);
page::add('<div id="page" class="clearfix">');
page::add('<div id="side">');
block::header('數據庫基本信息');
table::header();
table::row(array('w60' => '數據庫名稱', '2' => '' . $this->db->config['database'] . ''));
table::row(array('w60' => '數據庫版本', '2' => '' . $this->db->version(true) . ''));
table::row(array('w60' => '數據庫大小', '2' => '<b>' . $this->db->size() . '</b> '));
table::row(array('w60' => '數據表個數', '2' => '<b>' . count($tables) . '</b> 個'));
table::footer();
block::footer();
page::add('</div>');
page::add('<div id="main">');
page::top();
page::navbar($this->navbar(), 'table');
//zotop::dump($tables);
form::header(array('class' => 'ajax'));
$column['select'] = '<input name="id" class="selectAll" type="checkbox"/>';
$column['name'] = '數據表名稱';
$column['size w60'] = '大小';
$column['Rows w60'] = '記錄數';
$column['Engine w60'] = '類型';
$column['Collation w100'] = '整理';
$column['manage view w60'] = '瀏覽';
$column['manage delete'] = '刪除';
table::header('list', $column);
foreach ($tables as $table) {
$size = $table['Data_length'] + $table['Index_length'];
$column = array();
$column['select'] = '<input name="id[]" class="select" type="checkbox"/>';
$column['name'] = '<b>' . $table['Name'] . '</b><h5>' . $table['Comment'] . '</h5>';
$column['size w60'] = (string) format::size($size);
$column['Rows w60'] = $table['Rows'];
$column['Engine w60'] = $table['Engine'];
$column['collation w100'] = $table['Collation'];
$column['manage view w60'] = '<a href="' . url::build('system/database/table/record') . '">瀏覽</a>';
$column['manage delete'] = '<a href="' . url::build('system/database/table/delete') . '" class="confirm">刪除</a>';
table::row($column);
}
table::footer();
page::add('<div style="height:200px;"></div>');
form::buttons(array('type' => 'select', 'style' => 'width:180px', 'options' => array('check' => '優化', 'delete' => '刪除')), array('type' => 'submit', 'value' => '執行操作'));
form::footer();
page::bottom();
page::add('</div>');
page::add('</div>');
page::footer();
}
示例2: size
public function size()
{
$tables = $this->table()->get(true);
foreach ($tables as $table) {
$size += $table['Data_length'] + $table['Index_length'];
}
return format::size($size);
}