2011-11-16 183 views

回答

1

您需要application/config.php

/* 
|-------------------------------------------------------------------------- 
| Cache Directory Path 
|-------------------------------------------------------------------------- 
| 
| Leave this BLANK unless you would like to set something other than the default 
| system/cache/ folder. Use a full server path with trailing slash. 
| 
*/ 
$config['cache_path'] = 'var/www/site/public_html/application/cache/employee/cachefile'; 

//^or whatever your server path to that folder is!^
0

指定的,我知道你想創建一個緩存文件夾的子文件夾。所以,你可以修改系統/助理/ file_helper.php

功能WRITE_FILE()應該是這樣的

function write_file($path, $data, $mode = FOPEN_WRITE_CREATE_DESTRUCTIVE) 
{ 
    // Modifications here 
    # Usage: 
    # $this->cache->save('user/favourites/page1', $favourites); 
    # Will create folder 'user/favourites' at cache folder and file 'page1' with data 
    if (strpos($path, '/') !== false) { 
     $folders = explode('/', $path); 
     unset($folders[count($folders) - 1]); 
     $dir = implode('/', $folders); 
     mkdir($dir, 0744, TRUE); 
    } 
    // End of modifications 

    if (! $fp = @fopen($path, $mode)) 
    { 
     return FALSE; 
    } 

    flock($fp, LOCK_EX); 
    fwrite($fp, $data); 
    flock($fp, LOCK_UN); 
    fclose($fp); 

    return TRUE; 
} 

或者,您可以創建文件my_file_helper.php到「擴展」系統輔助和替代此功能。這是更好的解決方案。

相關問題