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 如何让企业微信机器人实现消息汇总整合
  • ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题
  • ¥15 如何用Python爬取各高校教师公开的教育和工作经历
  • ¥15 TLE9879QXA40 电机驱动
  • ¥20 对于工程问题的非线性数学模型进行线性化
  • ¥15 Mirare PLUS 进行密钥认证?(详解)
  • ¥15 物体双站RCS和其组成阵列后的双站RCS关系验证
  • ¥20 想用ollama做一个自己的AI数据库
  • ¥15 关于qualoth编辑及缝合服装领子的问题解决方案探寻
  • ¥15 请问怎么才能复现这样的图呀