Laravel 压缩变量 blade 文件显示为语法错误
Laravel Compact variable blade file display to syntax error
这是我的控制器代码:
public function method(Request $request){
$typeType = $request->type; //this variable show 'Booking'
return view('home.profile',compact('type'));
}
这是 blade 文件:
@extends('layouts.dashboard')
@section('page_heading',{{$taskType}})
@section('section')
//here some code
@stop
如果我使用此 blade 代码。然后我遇到了这个问题:
Parse error: syntax error, unexpected '<' (View:resources/view/home/profile.blade.php)
如果我在 blade
上使用此代码
@extends('layouts.dashboard')
@section('page_heading','{{$taskType}}')
@section('section')
//here some code
@stop
然后 blade 文件显示它:
<?php echo e($taskType); ?>
我想在 blade 文件中显示:
Booking
我该如何解决这个问题?
public function method(Request $request){
$typeType = $request->type; //this variable show 'Booking'
return view('home.profile')->with(['taskType' => $typeType]);
}
可能您不需要 {{ }}
Blade 指令。
因此将其更改为:
@section('page_heading', $taskType)
这是我的控制器代码:
public function method(Request $request){
$typeType = $request->type; //this variable show 'Booking'
return view('home.profile',compact('type'));
}
这是 blade 文件:
@extends('layouts.dashboard')
@section('page_heading',{{$taskType}})
@section('section')
//here some code
@stop
如果我使用此 blade 代码。然后我遇到了这个问题:
Parse error: syntax error, unexpected '<' (View:resources/view/home/profile.blade.php)
如果我在 blade
上使用此代码 @extends('layouts.dashboard')
@section('page_heading','{{$taskType}}')
@section('section')
//here some code
@stop
然后 blade 文件显示它:
<?php echo e($taskType); ?>
我想在 blade 文件中显示:
Booking
我该如何解决这个问题?
public function method(Request $request){
$typeType = $request->type; //this variable show 'Booking'
return view('home.profile')->with(['taskType' => $typeType]);
}
可能您不需要 {{ }}
Blade 指令。
因此将其更改为:
@section('page_heading', $taskType)