本文整理汇总了PHP中text::bytes方法的典型用法代码示例。如果您正苦于以下问题:PHP text::bytes方法的具体用法?PHP text::bytes怎么用?PHP text::bytes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类text
的用法示例。
在下文中一共展示了text::bytes方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: bytes
/**
* Tests the text::bytes() function.
* @dataProvider bytes_provider
* @group core.helpers.text.bytes
* @test
*/
public function bytes($bytes, $force_unit, $format, $si, $expected_result)
{
$result = text::bytes($bytes, $force_unit, $format, $si);
$this->assertEquals($expected_result, $result);
}
示例2: __
<?php
if ($image->author_id) {
?>
<dd><?php
echo __('Copyright © :year :author', array(':year' => date('Y', strtotime($image->created)), ':author' => html::user($image->author)));
?>
</dd>
<?php
}
?>
<dd><?php
echo __('Added: :date', array(':date' => '<var>' . date::format('DMYYYY_HM', $image->created) . '</var>'));
?>
</dd>
<dd><?php
echo __('Image size: :size kB', array(':size' => '<var>' . text::bytes($image->original_size, 'KiB', '%01.2f') . '</var>'));
?>
</dd>
<dd><?php
echo __('Resolution: :resolution', array(':resolution' => sprintf('<var>%d×%d</var>', $image->original_width, $image->original_height)));
?>
</dd>
<dt><?php
echo __('Statistics');
?>
</dt>
<dd><?php
echo __('Comments: :comments', array(':comments' => '<var>' . $image->comments . '</var>'));
?>
</dd>
示例3:
</td>
<td><?php
echo $lines;
?>
</td>
</tr>
<?php
$total_size += $size;
$total_lines += $lines;
?>
<?php
}
?>
<tr align="left">
<th colspan="2">total</th>
<th><?php
echo text::bytes($total_size);
?>
</th>
<th><?php
echo number_format($total_lines);
?>
</th>
</tr>
</table>
</div>
<?php
}
?>
</div>
示例4: firephp
/**
* Add toolbar data to FirePHP console
*
*/
private static function firephp()
{
$firephp = FirePHP::getInstance(TRUE);
$firephp->fb('KOHANA DEBUG TOOLBAR:');
// Globals
$globals = array('Post' => empty($_POST) ? array() : $_POST, 'Get' => empty($_GET) ? array() : $_GET, 'Cookie' => empty($_COOKIE) ? array() : $_COOKIE, 'Session' => empty($_SESSION) ? array() : $_SESSION);
foreach ($globals as $name => $global) {
$table = array();
$table[] = array($name, 'Value');
foreach ((array) $global as $key => $value) {
if (is_object($value)) {
$value = get_class($value) . ' [object]';
}
$table[] = array($key, $value);
}
$message = "{$name}: " . count($global) . ' variables';
$firephp->fb(array($message, $table), FirePHP::TABLE);
}
// Database
$query_stats = self::get_queries();
//$total_time = $total_rows = 0;
$table = array();
$table[] = array('DB profile', 'SQL Statement', 'Time', 'Memory');
foreach ((array) $query_stats['data'] as $db => $queries) {
unset($queries['total']);
foreach ($queries as $query) {
$table[] = array($db, str_replace("\n", ' ', $query['name']), number_format($query['time'] * 1000, 3), number_format($query['memory'] / 1024, 3));
}
}
$message = 'Queries: ' . $query_stats['count'] . ' SQL queries took ' . number_format($query_stats['time'], 3) . ' seconds and ' . $query_stats['memory'] . ' b';
$firephp->fb(array($message, $table), FirePHP::TABLE);
// Benchmarks
$groups = self::get_benchmarks();
// application benchmarks
$total = array_pop($groups);
$table = array();
$table[] = array('Group', 'Benchmark', 'Count', 'Time', 'Memory');
foreach ((array) $groups as $group => $benchmarks) {
foreach ((array) $benchmarks as $name => $benchmark) {
$table[] = array(ucfirst($group), ucwords($benchmark['name']), number_format($benchmark['total_time'], 3) . ' s', text::bytes($benchmark['total_memory']));
}
}
$message = 'Application tooks ' . number_format($total['total_time'], 3) . ' seconds and ' . text::bytes($total['total_memory']) . ' memory';
$firephp->fb(array($message, $table), FirePHP::TABLE);
}
示例5: firephp
/**
* Add toolbar data to FirePHP console
*/
private static function firephp()
{
$firephp = FirePHP::getInstance(TRUE);
$firephp->fb('KOHANA DEBUG TOOLBAR:');
// Globals
$globals = array('Post' => empty($_POST) ? array() : $_POST, 'Get' => empty($_GET) ? array() : $_GET, 'Cookie' => empty($_COOKIE) ? array() : $_COOKIE, 'Session' => empty($_SESSION) ? array() : $_SESSION);
foreach ($globals as $name => $global) {
$table = array();
$table[] = array($name, 'Value');
foreach ((array) $global as $key => $value) {
if (is_object($value)) {
$value = get_class($value) . ' [object]';
}
$table[] = array($key, $value);
}
$message = "{$name}: " . count($global) . ' variables';
$firephp->fb(array($message, $table), FirePHP::TABLE);
}
// Database
$queries = self::get_queries();
$total_time = $total_rows = 0;
$table = array();
$table[] = array('SQL Statement', 'Time', 'Rows');
foreach ((array) $queries as $query) {
$table[] = array(str_replace("\n", ' ', $query['query']), number_format($query['time'], 3), $query['rows']);
$total_time += $query['time'];
$total_rows += $query['rows'];
}
$message = 'Queries: ' . count($queries) . ' SQL queries took ' . number_format($total_time, 3) . ' seconds and returned ' . $total_rows . ' rows';
$firephp->fb(array($message, $table), FirePHP::TABLE);
// Benchmarks
$benchmarks = self::get_benchmarks();
$table = array();
$table[] = array('Benchmark', 'Time', 'Memory');
foreach ((array) $benchmarks as $name => $benchmark) {
$table[] = array(ucwords(str_replace(array('_', '-'), ' ', str_replace(SYSTEM_BENCHMARK . '_', '', $name))), number_format($benchmark['time'], 3) . ' s', text::bytes($benchmark['memory']));
}
$message = 'Benchmarks: ' . count($benchmarks) . ' benchmarks took ' . number_format($benchmark['time'], 3) . ' seconds and used up ' . text::bytes($benchmark['memory']) . ' memory';
$firephp->fb(array($message, $table), FirePHP::TABLE);
}
示例6: foreach
foreach ((array) $benchmarks as $benchmark) {
?>
<tr class="<?php
echo text::alternate('odd', 'even');
?>
">
<td align="left"><?php
echo $benchmark['name'];
?>
</td>
<td align="right"><?php
echo sprintf('%.2f', $benchmark['time'] * 1000);
?>
ms</td>
<td align="right"><?php
echo text::bytes($benchmark['memory']);
?>
</td>
</tr>
<?php
}
?>
<?php
} else {
?>
<tr class="<?php
echo text::alternate('odd', 'even');
?>
">
<td colspan="3">no benchmarks to display</td>
</tr>