Home > Backend Development > PHP Tutorial > 读取文件,该怎么处理

读取文件,该怎么处理

WBOY
Release: 2016-06-13 11:49:44
Original
943 people have browsed it

读取文件
function read_static_cache($cache_name)
{
    if ((DEBUG_MODE & 2) == 2)
    {
        return false;
    }
    static $result = array();
    if (!empty($result[$cache_name]))
    {
        return $result[$cache_name];
    }
    $cache_file_path = ROOT_PATH . '/temp/static_caches/' . $cache_name . '.php';
    if (file_exists($cache_file_path))
    {
        include_once($cache_file_path);
        $result[$cache_name] = $data;
        return $result[$cache_name];
    }
    else
    {
        return false;
    }
}

变量$data何解,没定义就赋值
------解决方案--------------------
你看下 ROOT_PATH . '/temp/static_caches/' . $cache_name . '.php'这个临时文件 
里面应该有一个$data的数组
------解决方案--------------------
读取缓存的内容,而这个缓存是文件缓存。缓存的内容就是 $data = xxxx一大坨东西

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template