Laravel Blade views not showing the changes made to them

那年仲夏 提交于 2019-11-27 16:45:36

问题


System Details : Using WAMP2.5 in Windows 64 bit
MYSQL:5.6.17
PHP:5.5.12
Apache :2.4.9
I installed laravel via composer installation . It was all fine since recently all my views stopped showing any changes made to them . This is happening to views which use Blade template only.

I have created the blade files correctly and named them with filename.blade.php. My view File Structure -
views
        -layouts
                   defaults.blade.php
        show.blade.php
        login.blade.php
       

defaults.blade.php

<!DOCTYPE html>  
<html>
      <head></head>
<body>
  <div>
   <nav></nav>

       @yield('content')

  </div>
      @yield('footerscripts')

</body>
</html>

show.blade.php

@extends('layouts.defaults')
@section('content')
    --- SOME CONTENT ---
@stop

@section('footerscripts')
     --- js scripts ---
@stop

The same format was working perfectly but suddenly started acting strangely.Even after refreshing many times the view doesn't change,Once i tried deleting everything inside the view page still it showed up in the browser.
There are similar question but many didn't have accepted answer and the one with some ratings didn't worked for me . I also tried re-installing fresh new WAMP copy but no Help.It only works if i change its name but if i change it back to the original one it again starts showing the old version of it. Only happens with blade templating.


回答1:


If you use PHP Storm:

  1. open menu File → Settings

  2. go to Deployment → Options section

  3. then uncheck option Preserve files timestamps




回答2:


I'm not sure of the specifics, but this is related to how filemtime() is implemented in windows (possibly related bug here).

Illuminate\View\Compilers\BladeCompiler (well, it's parent class, Compiler) checks to see if a file has changed since last compilation by checking it's mtime, through Illuminate\Filesystem\Filesystem which calls calls filemtime() (see L179-188). Evidently this is failing to report properly on your system.

First, ensure that the app/storage/views directory has read, write and delete permissions. If this doesn't help, the simplest solution would be to clear the app/storage/views/ directory whenever making a change.




回答3:


I had this same issue , reason was I am doing uploads remote, but the time on my computer was different than what that was on my server




回答4:


  1. In your cmd(command prompt) or terminal type and press enter... php artisan view:clear

For this to work, your terminal should be pointed to your root directory of your laravel installation/folder

  1. Or delete files in the folder storage/framework/views

In order to avoid the parsing of Blade files on each reload, Laravel is designed to caches views after Blade is parsed, to avoid re-parsing the blades on each reload.

  1. Or make sure you are editing the right view, in the right Laravel Installation.


来源:https://stackoverflow.com/questions/24539087/laravel-blade-views-not-showing-the-changes-made-to-them

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!