[英]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'));
}
这是刀片文件:
@extends('layouts.dashboard')
@section('page_heading',{{$taskType}})
@section('section')
//here some code
@stop
如果我使用此刀片代码。 然后我有这个问题:
解析错误:语法错误,意外的'<'(View:resources / view / home / profile.blade.php)
如果我在刀片上使用此代码
@extends('layouts.dashboard')
@section('page_heading','{{$taskType}}')
@section('section')
//here some code
@stop
然后刀片文件显示它:
<?php echo e($taskType); ?>
我想在刀片文件上显示它:
Booking
我怎么解决这个问题?
也许您不需要刀片指令中的{{ }}
。
因此将其更改为:
@section('page_heading', $taskType)
public function method(Request $request){
$typeType = $request->type; //this variable show 'Booking'
return view('home.profile')->with(['taskType' => $typeType]);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.