本文整理汇总了PHP中PMA_get_real_size函数的典型用法代码示例。如果您正苦于以下问题:PHP PMA_get_real_size函数的具体用法?PHP PMA_get_real_size怎么用?PHP PMA_get_real_size使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PMA_get_real_size函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkUploadSize
/**
* Maximum upload size as limited by PHP
* Used with permission from Moodle (http://moodle.org) by Martin Dougiamas
*
* this section generates $max_upload_size in bytes
*/
function checkUploadSize()
{
if (!($filesize = ini_get('upload_max_filesize'))) {
$filesize = "5M";
}
if ($postsize = ini_get('post_max_size')) {
$this->set('max_upload_size', min(PMA_get_real_size($filesize), PMA_get_real_size($postsize)));
} else {
$this->set('max_upload_size', PMA_get_real_size($filesize));
}
}
示例2: testGigabyte
public function testGigabyte()
{
$this->assertEquals(12 * 1024 * 1024 * 1024, PMA_get_real_size('12gb'));
}
示例3: foreach
//1024 * 1024 * 1024;
$scan['mb'] = 1048576;
$scan['m'] = 1048576;
$scan['kb'] = 1024;
$scan['k'] = 1024;
$scan['b'] = 1;
foreach ($scan as $unit => $factor) {
if (strlen($size) > strlen($unit) && strtolower(substr($size, strlen($size) - strlen($unit))) == $unit) {
return substr($size, 0, strlen($size) - strlen($unit)) * $factor;
}
}
return $size;
}
// end function PMA_get_real_size()
$upload_max_filesize = PMA_get_real_size(ini_get('upload_max_filesize'));
$post_max_size = PMA_get_real_size(ini_get('post_max_size'));
$min_upload_size = $upload_max_filesize > $post_max_size ? $post_max_size : $upload_max_filesize;
$max_upload_filesize = $min_upload_size / 1024 / 1024 . ' MB';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<link href="css/default.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="swfupload/swfupload.js"></script>
<script type="text/javascript" src="js/swfupload.swfobject.js"></script>
<script type="text/javascript" src="js/swfupload.queue.js"></script>
<script type="text/javascript" src="js/fileprogress.js"></script>
<script type="text/javascript" src="js/handlers.js"></script>
<script type="text/javascript">
示例4: testUnspecified
public function testUnspecified()
{
$this->assertEquals(1024, PMA_get_real_size('1024'));
}