duanliang4009 2012-01-03 15:12
浏览 384
已采纳

Symfony缓存默认文件夹路径

Symfony2 keeps cache in app\cache folder

Is there a way to change it to different path?

Thanks for any help!

Answer:

Thanks to Aurelijus Valeiša for this!

I did add method (to AppKernel.php) like this:

public function getCacheDir()
{
    // Remove whole method if you want to go back to the original cache folder
    return 'c:/Users/Mike/Documents/www/cache/'.$this->environment;
}  

If you want to do the same with logs folder add this method:

public function getLogDir()
{
    // Remove whole method if you want to go back to the original log folder
    return 'c:/Users/Mike/Documents/www/logs';
}

Make a note that both methods just overwrite original which are created in Symfony\Component\HttpKernel\Kernel class

  • 写回答

1条回答 默认 最新

  • douganmo1121 2012-01-03 15:57
    关注

    Yes, in app/AppKernel.php file override getCacheDir() method (defined in Symfony\Component\HttpKernel\Kernel). As the example, in your extended AppKernel class you could have:

    public function getCacheDir()
    {
        return $this->rootDir.'/superduper_cache/'.$this->environment;
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!