|
楼主 |
发表于 2012-2-20 14:52:55
|
显示全部楼层
PHP复制代码 public function delete_cache ($url = "")
{
$url = trim($url, "/");
$this->_delete_cache ($url);
}
public function _delete_cache ($url)
{
$CI =& get_instance ();
$path = $CI->config->item('cache_path');
$cache_path = ($path == '') ? APPPATH .'cache/' : $path;
$uri = $CI->config->item('base_url').
$CI->config->item('index_page').$url;
$filepath = $cache_path.md5($uri);
if ( ! @file_exists($filepath))
{
return FALSE;
} if ( ! $fp = @fopen($filepath, FOPEN_READ ))
{
return FALSE;
}
if (is_really_writable ($cache_path))
{
@unlink($filepath);
log_message ('debug', "Cache file has deleted.");
return TRUE;
}
return FALSE;
复制代码
|
|