2024 PHP Conference Japan

realpath_cache_get

(PHP 5 >= 5.3.2, PHP 7, PHP 8)

realpath_cache_get取得 realpath 快取項目

說明

realpath_cache_get(): 陣列

取得 realpath 快取的內容。

參數

此函式沒有參數。

回傳值

傳回一個包含 realpath 快取項目的陣列。鍵是原始路徑項目,值是資料項目的陣列,包含解析後的路徑、到期日期和其他保存在快取中的選項。

範例

範例 #1 realpath_cache_get() 範例

<?php
var_dump
(realpath_cache_get());
?>

上述範例將輸出類似以下的內容

array(2) {
  ["/test"]=>
  array(4) {
    ["key"]=>
    int(123456789)
    ["is_dir"]=>
    bool(true)
    ["realpath"]=>
    string(5) "/test"
    ["expires"]=>
    int(1260318939)
  }
  ["/test/test.php"]=>
  array(4) {
    ["key"]=>
    int(987654321)
    ["is_dir"]=>
    bool(false)
    ["realpath"]=>
    string(12) "/root/test.php"
    ["expires"]=>
    int(1260318939)
  }
}

另請參閱

新增註解

使用者貢獻的註解 1 則註解

phil at code67 dot com
9 年前
請注意,如果開啟了安全模式 (safe_mode) 或存在 open_basedir 限制,則不會使用 realpath 快取。
這會造成巨大的效能影響,導致大量呼叫 lstat。

已在 http://bugs.php.net/bug.php?id=52312 提交錯誤報告。
To Top