简体   繁体   中英

Syntax errors in blades Laravel 5.3

I am migrating from Laravel 4.3 to 5.3 and things are going fine except one thing, I can`t properly debug blade syntax errors.

For example I had a typo in my blade, the typo was in a file home.blade.php, but the error is reported like this:

Whoops, looks like something went wrong.

1/1
FatalErrorException in c53354289a35d504fdc7d35ecbfb9b4348f1f804.php line 25:
syntax error, unexpected ';'

In laravel 4.3 and bellow blade file name is also reported. With this system it's hard to track down error unless I look at the compiled view, which is a hassle. Am I missing something here?

The name is coming from storage/framework/views/

check the content of the file and you can find the view

It's indeed a little struggle to find the file you are looking for. The only way I got this to work properly is to put a little HTML comment in the blade files, with the correspondig view filename. That way, you can extract the original blade file from the compiled one.

You can try something like this (in your views):

@section('content')
  <!-- VIEW: this/view/file.blade.php -->

  // content goes here
@endsection

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM