请注意,如果 safe_mode 启用或 open_basedir 限制生效,则不会使用 realpath 缓存。
这会产生巨大的性能影响,导致大量调用 lstat。
已在 http://bugs.php.net/bug.php?id=52312 提交了错误报告(PHP 5 >= 5.3.2, PHP 7, PHP 8)
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)
}
}
请注意,如果 safe_mode 启用或 open_basedir 限制生效,则不会使用 realpath 缓存。
这会产生巨大的性能影响,导致大量调用 lstat。
已在 http://bugs.php.net/bug.php?id=52312 提交了错误报告