那些很神奇的bug系列——2

在使用laravel进行的开发的过程中,使用blade的过程中总会出现一些看起来莫名其妙的bug

最近有遇到了一个比较坑的bug

由于看到网络上已经有人提问和回答的比较好了,我就不自己重写一遍了,直接引用过来

I am developing a Laravel(5.2.29) project in Windows environment and testing it on Chrome browser.

I have made some changes on a Blade file using atom text editor and then refreshed my page and noticed that suddenly it has stopped reflecting the changes (it's loading the old Blade file).

I've tried the following:

Restarted the browser
Clearing browser cache
Running php artisan cache:clear
Running composer dumpautoload
Deleting the Blade file (and got a view not found error).
Then created a new Blade file with the same name, with no >content and refreshed the page.
No matter what, the code displayed on the browser is >always the same (old) version and not the content of the >Blade file.

问题解决方案如下:

In order to avoid the parsing of Blade files on each reload, Laravel caches the views after Blade is processed. I've experienced some situations where the source (view file) is updated but the cache file is not "reloaded". In these cases, all you need to do is to delete the cached views and reload the page.

The cached view files are stored in storage/framework/views.

一句话总结就是,可能因为blade缓存的原因,所以当遇到明明自己更改了文件,但死活在浏览器刷新不出来,就可以吧/storage/framework/views下的缓存文件都删除掉


参考网站

  • Blade view not reflecting changes

你可能感兴趣的:(那些很神奇的bug系列——2)