php CodeIgniter 中的页面缓存是如何清除的

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7422013/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 02:38:54  来源:igfitidea点击:

How is clear page cache in the CodeIgniter

phpcodeignitercaching

提问by Jennifer Anthony

I use CodeIgniter. Always part of my page is cache and don't remove by Ctrl+F5in the browser. When I change the name page in the view it worked !!!?

我使用 CodeIgniter。我页面的一部分总是缓存,不要Ctrl+F5在浏览器中删除。当我在视图中更改名称页面时,它起作用了!!!?

How can clear page cache in the CodeIgniter?

如何清除 CodeIgniter 中的页面缓存?

回答by birderic

You need to manually delete the cached items in the application/cachefolder.

您需要手动删除application/cache文件夹中的缓存项目。

https://www.codeigniter.com/user_guide/general/caching.html

https://www.codeigniter.com/user_guide/general/caching.html

回答by cesarve

function delete_cache($uri_string=null)
{
    $CI =& get_instance();
    $path = $CI->config->item('cache_path');
    $path = rtrim($path, DIRECTORY_SEPARATOR);

    $cache_path = ($path == '') ? APPPATH.'cache/' : $path;

    $uri =  $CI->config->item('base_url').
            $CI->config->item('index_page').
            $uri_string;

    $cache_path .= md5($uri);

    return unlink($cache_path);
}

回答by Tarek Sumch

public function clear_path_cache($uri)
{
    $CI =& get_instance();
    $path = $CI->config->item('cache_path');
    //path of cache directory
    $cache_path = ($path == '') ? APPPATH.'cache/' : $path;

    $uri =  $CI->config->item('base_url').
    $CI->config->item('index_page').
    $uri;
    $cache_path .= md5($uri);

    return @unlink($cache_path);
}




/**
 * Clears all cache from the cache directory
 */
public function clear_all_cache()
{
    $CI =& get_instance();
    $path = $CI->config->item('cache_path');

    $cache_path = ($path == '') ? APPPATH.'cache/' : $path;

    $handle = opendir($cache_path);
    while (($file = readdir($handle))!== FALSE) 
    {
        //Leave the directory protection alone
        if ($file != '.htaccess' && $file != 'index.html')
        {
           @unlink($cache_path.'/'.$file);
        }
    }
    closedir($handle);       
}

回答by Naftali aka Neal

It is probably in a session.Try deleting your cookies.

它可能在session.Try 中删除您的 cookie。