realpath_cache_get

(PHP 5 >= 5.3.2, PHP 7)

realpath_cache_get获取真实目录缓存的详情

说明

realpath_cache_get ( void ) : array

获得真实路径缓存的详情。

返回值

返回真实路径缓存详情的数组。键是原始路径以及值为具体信息数组,含有该解析的路径,过期时间以及其他的更多选项。

范例

Example #1 realpath_cache_get() example

<?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)
  }
}

参见

User Contributed Notes

phil at code67 dot com 05-Oct-2015 10:10
Note that the realpath cache is not used if either safe_mode is on or an open_basedir restriction is in effect.
This is having a huge performance effect, causing lots of calls to lstat.

A bugreport has already been filed at http://bugs.php.net/bug.php?id=52312