简体   繁体   English

Laravel 4.2查看缓存问题

[英]Laravel 4.2 View caching issue

I am updating view and refreshing the route which is rendering that particular view. 我正在更新视图并刷新呈现该特定视图的路线。 But it loads previous view. 但是它将加载以前的视图。 After multiple refresh I get the latest updated view. 多次刷新后,我得到了最新的更新视图。 Can you please explain me in detail how my view should not be cached and i should get updated view only. 您能详细解释一下我的视图如何不被缓存,我应该只获取更新的视图。

I'd recommend to set debug to true, open your browser dev tools and check the option to don't cache pages when dev tools are opened and finally, give 777 permissions to you storage folder (I don't remember the name of the folder in Laravel 4.2) where compiled views are stored as sometimes the system can't write on that location. 我建议将debug设置为true,打开浏览器开发工具,并选中打开开发工具时不缓存页面的选项,最后为您的存储文件夹授予777权限(我不记得它的名称了Laravel 4.2中的“文件夹”),因为有时系统无法在该位置写入,因此已存储已编译视图的视图。 I think it should be enough for you to get the view updated on refresh. 我认为只要刷新就可以更新视图。

In Laravel 4.2 you can't run the command php artisan cache:clear to remove the views. 在Laravel 4.2中,您无法运行php artisan cache:clear命令删除视图。 That's because they aren't cached , their compiled . 那是因为它们没有被缓存 ,而是 编译了

Laravel 5.1 and greater implemented the command php artisan view:clear to clear compiled views, but here is a custom command you can use in Laravel 4.2 to clear them: Laravel 5.1和更高版本实现了php artisan view:clear命令php artisan view:clear可以清除编译的视图,但这是您可以在Laravel 4.2中使用的自定义命令来清除它们:

https://gist.github.com/cjonstrup/8228165 https://gist.github.com/cjonstrup/8228165

Otherwise, just delete all the files in app/storage/views and views will be re-compiled. 否则,只需删除app/storage/views所有文件,视图将被重新编译。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM