doubinduo3364 2017-02-07 23:54
浏览 27
已采纳

Laravel - php工匠的观点是什么:清楚吗?

I run a command php artisan view:clear, as I followed a tutorial on custom 404 pages in Laravel, and as explained, the command Clears all compiled view files, further on I looked it up in laravel docs and it said that it removes the cache from view files. The reason why im asking this is because

  • im not sure if this effects my view files
  • Will they stay the same?
  • Did i remove something important running this command?
  • What are these cache files for?
  • Will this effect my future work?
  • 写回答

1条回答 默认 最新

  • dskm94301 2017-02-08 00:01
    关注

    This command basically just clears out all cached views.

    Rather than loading your view every time, a cached copy can be stored in your storage folder. View caching is done because blade compiling each time is a waste of time, as blade obviously turns the template in to a proper PHP file.

    By running php artisan view:clear you simply clear out all the cached views, and so next time the blade view is loaded it will be compiled again rather than pulling it from the cache.

    im not sure if this effects my view files

    This does not effect the views themselves, it simply clears the cached copies.

    Will they stay the same?

    Your views themselves will stay the same, yes.

    Did i remove something important running this command?

    Only the cached copies of your views. These will simply be compiled again when the page is loaded.

    What are these cache files for?

    To prevent blade having to compile every time it is called, it can be done just once to prevent wasting this time.

    Will this effect my future work?

    Not at all.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 在若依框架下实现人脸识别
  • ¥15 网络科学导论,网络控制
  • ¥100 安卓tv程序连接SQLSERVER2008问题
  • ¥15 利用Sentinel-2和Landsat8做一个水库的长时序NDVI的对比,为什么Snetinel-2计算的结果最小值特别小,而Lansat8就很平均
  • ¥15 metadata提取的PDF元数据,如何转换为一个Excel
  • ¥15 关于arduino编程toCharArray()函数的使用
  • ¥100 vc++混合CEF采用CLR方式编译报错
  • ¥15 coze 的插件输入飞书多维表格 app_token 后一直显示错误,如何解决?
  • ¥15 vite+vue3+plyr播放本地public文件夹下视频无法加载
  • ¥15 c#逐行读取txt文本,但是每一行里面数据之间空格数量不同