略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: realpath_cache_get

2024-11-14

realpath_cache_get

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

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

说明

realpath_cache_get(): array

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

返回值

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

范例

示例 #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)
  }
}

参见

add a noteadd a note

User Contributed Notes 1 note

up
3
phil at code67 dot com
6 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

官方地址:https://www.php.net/manual/en/function.realpath-cache-get.php

北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3