memory.php > OX_checkMemoryCanBeSet()

概要

  • memory_limitが変更できるか調べる
  • Trueで変更可能

引数

なし

実装

function OX_checkMemoryCanBeSet()
{
  • 無制限ならチェックしない
$phpMemoryLimitInBytes = OX_getMemoryLimitSizeInBytes();
    // Unlimited memory, no need to check if it can be set
    if ($phpMemoryLimitInBytes == -1) {
        return true;
    }
    OX_increaseMemoryLimit($phpMemoryLimitInBytes + 1);
    $newPhpMemoryLimitInBytes = OX_getMemoryLimitSizeInBytes();
    $memoryCanBeSet = ($phpMemoryLimitInBytes != $newPhpMemoryLimitInBytes);

    // Restore previous limit
    @ini_set('memory_limit', $phpMemoryLimitInBytes);
    return $memoryCanBeSet;
}

コメント

タグ:

+ タグ編集
  • タグ:
最終更新:2011年05月01日 02:05
ツールボックス

下から選んでください:

新しいページを作成する
ヘルプ / FAQ もご覧ください。