PHP Conference Nagoya 2025

realpath_cache_get

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

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

说明

realpath_cache_get(): array

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

参数

此函数没有参数。

返回值

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

示例

示例 #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 note

up
2
phil at code67 dot com
9 years ago
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
To Top