问题
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:
open menu
File → Settings
go to
Deployment → Options
sectionthen 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:
- 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
- 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.
- 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