当前位置: 首页>>代码示例>>PHP>>正文


PHP convertPHPSizeToBytes函数代码示例

本文整理汇总了PHP中convertPHPSizeToBytes函数的典型用法代码示例。如果您正苦于以下问题:PHP convertPHPSizeToBytes函数的具体用法?PHP convertPHPSizeToBytes怎么用?PHP convertPHPSizeToBytes使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了convertPHPSizeToBytes函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _check_requirements


//.........这里部分代码省略.........
             case 2:
                 $exists = is_dir($path);
                 break;
             default:
                 throw new Exception('Invalid type given.');
         }
         if ($exists) {
             $aData[$base . 'Present'] = 'Found';
             if (!$bRecursive && is_writable($path) || $bRecursive && is_writable_recursive($path)) {
                 $aData[$base . 'Writable'] = 'Writable';
                 $bResult = true;
             } else {
                 $aData[$base . 'Writable'] = 'Unwritable';
             }
         }
         $bResult || ($aData[$keyError] = true);
         return $bResult;
     }
     /**
      * check if file exists and is writeable, returns via parameters by reference
      *
      * @param string $file to check
      * @param string $data to manipulate
      * @param string $base key for data manipulation
      * @param string $keyError key for error data
      * @return bool result of check (that it is writeable which implies existance)
      */
     function check_FileWriteable($file, &$data, $base, $keyError)
     {
         return check_PathWriteable($file, 1, $data, $base, $keyError);
     }
     /**
      * check if directory exists and is writeable, returns via parameters by reference
      *
      * @param string $directory to check
      * @param string $data to manipulate
      * @param string $base key for data manipulation
      * @param string $keyError key for error data
      * @return bool result of check (that it is writeable which implies existance)
      */
     function check_DirectoryWriteable($directory, &$data, $base, $keyError, $bRecursive = false)
     {
         return check_PathWriteable($directory, 2, $data, $base, $keyError, $bRecursive);
     }
     //  version check
     if (version_compare(PHP_VERSION, '5.3.0', '<')) {
         $bProceed = !($aData['verror'] = true);
     }
     if (convertPHPSizeToBytes(ini_get('memory_limit')) / 1024 / 1024 < 64 && ini_get('memory_limit') != -1) {
         $bProceed = !($aData['bMemoryError'] = true);
     }
     // mbstring library check
     if (!check_PHPFunction('mb_convert_encoding', $aData['mbstringPresent'])) {
         $bProceed = false;
     }
     // JSON library check
     if (!check_PHPFunction('json_encode', $aData['bJSONPresent'])) {
         $bProceed = false;
     }
     // ** file and directory permissions checking **
     // config directory
     if (!check_DirectoryWriteable(Yii::app()->getConfig('rootdir') . '/application/config', $aData, 'config', 'derror')) {
         $bProceed = false;
     }
     // templates directory check
     if (!check_DirectoryWriteable(Yii::app()->getConfig('tempdir') . '/', $aData, 'tmpdir', 'tperror', true)) {
         $bProceed = false;
     }
     //upload directory check
     if (!check_DirectoryWriteable(Yii::app()->getConfig('uploaddir') . '/', $aData, 'uploaddir', 'uerror', true)) {
         $bProceed = false;
     }
     // Session writable check
     $session = Yii::app()->session;
     /* @var $session CHttpSession */
     $sessionWritable = $session->get('saveCheck', null) === 'save';
     $aData['sessionWritable'] = $sessionWritable;
     $aData['sessionWritableImg'] = check_HTML_image($sessionWritable);
     if (!$sessionWritable) {
         // For recheck, try to set the value again
         $session['saveCheck'] = 'save';
         $bProceed = false;
     }
     // ** optional settings check **
     // gd library check
     if (function_exists('gd_info')) {
         $aData['gdPresent'] = check_HTML_image(array_key_exists('FreeType Support', gd_info()));
     } else {
         $aData['gdPresent'] = check_HTML_image(false);
     }
     // ldap library check
     check_PHPFunction('ldap_connect', $aData['ldapPresent']);
     // php zip library check
     check_PHPFunction('zip_open', $aData['zipPresent']);
     // zlib php library check
     check_PHPFunction('zlib_get_coding_type', $aData['zlibPresent']);
     // imap php library check
     check_PHPFunction('imap_open', $aData['bIMAPPresent']);
     return $bProceed;
 }
开发者ID:Narasimman,项目名称:UrbanExpansion,代码行数:101,代码来源:InstallerController.php

示例2: getMaximumFileUploadSize

 function getMaximumFileUploadSize()
 {
     return min(convertPHPSizeToBytes(ini_get('post_max_size')), convertPHPSizeToBytes(ini_get('upload_max_filesize')));
 }
开发者ID:fernandopetry,项目名称:pwork,代码行数:4,代码来源:PHPUploadMaxSize.php

示例3: eT

               <td>64MB</td>
               <td><?php 
if (isset($bMemoryError) && $bMemoryError) {
    ?>
<span style='font-weight:bold; color: red'><?php 
    eT("Too low");
    ?>
: <?php 
    echo convertPHPSizeToBytes(ini_get('memory_limit')) / 1024 / 1024;
    ?>
MB</span>
               <?php 
} elseif (ini_get('memory_limit') == '-1') {
    eT("Unlimited");
} else {
    echo convertPHPSizeToBytes(ini_get('memory_limit')) / 1024 / 1024;
    echo ' MB';
}
?>
</td>
        </tr>
        <tr>
               <td><?php 
eT("PHP PDO driver library");
?>
</td>
               <td><?php 
eT("At least one installed");
?>
</td>
               <td><?php 
开发者ID:sickpig,项目名称:LimeSurvey,代码行数:31,代码来源:precheck_view.php

示例4: getMaximumFileUploadSize

function getMaximumFileUploadSize()
{
    $get_min = min(convertPHPSizeToBytes(ini_get('post_max_size')), convertPHPSizeToBytes(ini_get('upload_max_filesize')));
    if ($get_min == convertPHPSizeToBytes(ini_get('post_max_size'))) {
        return ini_get('post_max_size');
    } else {
        return ini_get('upload_max_filesize');
    }
}
开发者ID:hisapi,项目名称:his,代码行数:9,代码来源:utility.functions.php

示例5: if

        <th class='text-center'><?php $clang->eT("Current"); ?></th>
 </tr>
 </thead>
 <tbody>
 <tr>
        <td><?php $clang->eT("PHP version"); ?></td>
        <td>5.3.0+</td>
        <td><?php if (isset($verror) && $verror) { ?><span style='font-weight:bold; color: red'><?php $clang->eT("Outdated"); ?>: <?php echo $phpVersion; ?></span>
        <?php } else { ?><?php echo $phpVersion ; ?> <?php } ?></td>
 </tr>
 <tr>
        <td><?php $clang->eT("Minimum memory available"); ?></td>
        <td>64MB</td>
        <td><?php
        if (isset($bMemoryError) && $bMemoryError) { ?><span style='font-weight:bold; color: red'><?php $clang->eT("Too low"); ?>: <?php echo convertPHPSizeToBytes(ini_get('memory_limit'))/1024/1024; ?>MB</span>
        <?php } elseif (ini_get('memory_limit')=='-1') $clang->eT("Unlimited"); else { echo convertPHPSizeToBytes(ini_get('memory_limit'))/1024/1024; echo ' MB';} ?></td>
 </tr>
 <tr>
        <td><?php $clang->eT("PHP PDO driver library"); ?></td>
        <td><?php $clang->eT("At least one installed"); ?></td>
        <td><?php if (count($dbtypes)==0) { ?><span style='font-weight:bold; color: red'><?php $clang->eT("None found"); ?></span>
        <?php } else { ?><?php echo implode(', ',$dbtypes); ?> <?php } ?></td>
 </tr>
 <tr>
        <td><?php $clang->eT("PHP mbstring library"); ?></td>
        <td><img src="<?php echo Yii::app()->baseUrl; ?>/installer/images/tick-right.png" alt="Yes" /></td>
        <td><?php echo $mbstringPresent; ?></td>
 </tr>
 <tr>
        <td><?php $clang->eT("PHP/PECL JSON library"); ?></td>
        <td><img src="<?php echo Yii::app()->baseUrl; ?>/installer/images/tick-right.png" alt="Yes" /></td>
开发者ID:rouben,项目名称:LimeSurvey,代码行数:31,代码来源:precheck_view.php

示例6: _init

 protected function _init()
 {
     // Check for most necessary requirements
     // Now check for PHP & db version
     // Do not localize/translate this!
     $dieoutput = '';
     if (version_compare(PHP_VERSION, '5.3.3', '<')) {
         $dieoutput .= 'This script can only be run on PHP version 5.3.3 or later! Your version: ' . PHP_VERSION . '<br />';
     }
     if (!function_exists('mb_convert_encoding')) {
         $dieoutput .= "This script needs the PHP Multibyte String Functions library installed: See <a href='http://manual.limesurvey.org/wiki/Installation_FAQ'>FAQ</a> and <a href='http://de.php.net/manual/en/ref.mbstring.php'>PHP documentation</a><br />";
     }
     if ($dieoutput != '') {
         throw new CException($dieoutput);
     }
     if (ini_get("max_execution_time") < 1200) {
         @set_time_limit(1200);
     }
     // Maximum execution time - works only if safe_mode is off
     if (ini_get('memory_limit') != -1 && convertPHPSizeToBytes(ini_get("memory_limit")) < convertPHPSizeToBytes(Yii::app()->getConfig('memory_limit') . 'M')) {
         @ini_set("memory_limit", Yii::app()->getConfig('memory_limit') . 'M');
         // Set Memory Limit for big surveys
     }
     // The following function (when called) includes FireBug Lite if true
     defined('FIREBUG') or define('FIREBUG', Yii::app()->getConfig('use_firebug_lite'));
     //Every 50th time clean up the temp directory of old files (older than 1 day)
     //depending on the load the  probability might be set higher or lower
     if (rand(1, 50) == 1) {
         cleanTempDirectory();
     }
     //GlobalSettings Helper
     Yii::import("application.helpers.globalsettings");
     enforceSSLMode();
     // This really should be at the top but for it to utilise getGlobalSetting() it has to be here
     if (Yii::app()->getConfig('debug') == 1) {
         //For debug purposes - switch on in config.php
         @ini_set("display_errors", 1);
         error_reporting(E_ALL);
     } elseif (Yii::app()->getConfig('debug') == 2) {
         //For debug purposes - switch on in config.php
         @ini_set("display_errors", 1);
         error_reporting(E_ALL | E_STRICT);
     } else {
         @ini_set("display_errors", 0);
         error_reporting(0);
     }
     //SET LOCAL TIME
     $timeadjust = Yii::app()->getConfig("timeadjust");
     if (substr($timeadjust, 0, 1) != '-' && substr($timeadjust, 0, 1) != '+') {
         $timeadjust = '+' . $timeadjust;
     }
     if (strpos($timeadjust, 'hours') === false && strpos($timeadjust, 'minutes') === false && strpos($timeadjust, 'days') === false) {
         Yii::app()->setConfig("timeadjust", $timeadjust . ' hours');
     }
     //Yii::app()->setConfig('adminimageurl', Yii::app()->getConfig('styleurl').Yii::app()->getConfig('admintheme').'/images/');
     //Yii::app()->setConfig('adminstyleurl', Yii::app()->getConfig('styleurl').Yii::app()->getConfig('admintheme').'/');
 }
开发者ID:mfavetti,项目名称:LimeSurvey,代码行数:57,代码来源:LSYii_Controller.php

示例7: getMaximumFileUploadSize

function getMaximumFileUploadSize()
{
    // http://stackoverflow.com/questions/13076480/php-get-actual-maximum-upload-size
    return min(convertPHPSizeToBytes(ini_get('post_max_size')), convertPHPSizeToBytes(ini_get('upload_max_filesize')));
}
开发者ID:mehulsbhatt,项目名称:PHP-Scanner-Server,代码行数:5,代码来源:printer.php


注:本文中的convertPHPSizeToBytes函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。