當前位置: 首頁>>代碼示例>>PHP>>正文


PHP PMA_getRealSize函數代碼示例

本文整理匯總了PHP中PMA_getRealSize函數的典型用法代碼示例。如果您正苦於以下問題:PHP PMA_getRealSize函數的具體用法?PHP PMA_getRealSize怎麽用?PHP PMA_getRealSize使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了PMA_getRealSize函數的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
  *
  * @return void
  */
 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_getRealSize($filesize), PMA_getRealSize($postsize)));
     } else {
         $this->set('max_upload_size', PMA_getRealSize($filesize));
     }
 }
開發者ID:nvq247,項目名稱:joomla15test,代碼行數:19,代碼來源:Config.class.php

示例2: PMA_getRealSize

 *
 * @param string $size size
 *
 * @return integer $size
 */
function PMA_getRealSize($size = 0)
{
    /*    
        if (! $size) {
            return 0;
        }
    */
    $scan['gb'] = 1073741824;
    //1024 * 1024 * 1024;
    $scan['g'] = 1073741824;
    //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) && substr($size, strlen($size) - strlen($unit)) == $unit) {
            return substr($size, 0, strlen($size) - strlen($unit)) * $factor;
        }
    }
    return $size;
}
$in = user_input();
echo PMA_getRealSize($in) . "\n";
開發者ID:phpsemantics,項目名稱:PHP-Static-Analyser,代碼行數:30,代碼來源:PMA-4.php

示例3: testUnspecified

 public function testUnspecified()
 {
     $this->assertEquals(1024, PMA_getRealSize('1024'));
 }
開發者ID:nhodges,項目名稱:phpmyadmin,代碼行數:4,代碼來源:PMA_get_real_size_test.php

示例4: testNull

 /**
  * Test for
  *
  * @param string $size     Size
  * @param int    $expected Expected value
  *
  * @return void
  *
  * @dataProvider provider
  */
 public function testNull($size, $expected)
 {
     $this->assertEquals($expected, PMA_getRealSize($size));
 }
開發者ID:FilipeRamosFernandes,項目名稱:phpmyadmin,代碼行數:14,代碼來源:PMA_get_real_size_test.php


注:本文中的PMA_getRealSize函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。