Php Laravel 4-视图未渲染
简单视图不渲染:Php Laravel 4-视图未渲染,php,laravel,Php,Laravel,简单视图不渲染: public function getFranchise() { echo 'getFranchise'; $franchiseData['shopViews'] = array(1 => 'a'); $franchiseData['aaa'] = 'bbb'; return View::make('test.filteredData.franchise', $franchiseData); } 在test/filteredData/
public function getFranchise() {
echo 'getFranchise';
$franchiseData['shopViews'] = array(1 => 'a');
$franchiseData['aaa'] = 'bbb';
return View::make('test.filteredData.franchise', $franchiseData);
}
在test/filteredData/francement.blade.php中查看
franchise
{{--$shopsViews}} {{-- Fatal error: Method Illuminate\View\View::__toString() must not throw an exception in D:\projektai\dashboard\app\storage\views\d2973247ea68aed2fdfd33dc19cccada on line 5}}
{{ $aaa }}
@foreach ($shopsViews as $shop)
<strong>aaa</strong>
@endforeach
已编辑
发现:
{{--$shopsViews}} {{-- Fatal error: Method Illuminate\View\View::__toString() must not throw an exception in D:\projektai\dashboard\app\storage\views\d2973247ea68aed2fdfd33dc19cccada on line 5}}
注释导致脚本中的执行停止。为什么呢?这是有效的laravel评论。我在评论的时候也注意到了一些奇怪的事情
<?php //print_r ?>
然后它会显示一些东西,比如找不到网页,比如互联网连接消失了。我完全不明白评论会发生什么。您的刀片视图必须包含@extends()和@section(),才能在这种情况下工作。 注释应该是这样的{{--$shopsViews--}。这会解决你的问题
@extends('your_layout_folder.layout')
@section('content')
@foreach ($shopsViews as $shop)
<strong>aaa</strong>
@endforeach
@stop
@extends('your\u layout\u folder.layout'))
@节(“内容”)
@foreach($shopsview as$shop)
aaa
@endforeach
@停止
请遵循文档 有趣。我读了文件,但我认为没有必要扩展。我不想。但如果这是唯一的解决办法,那么我将不得不考虑。顺便说一句,你写的评论和我写的一样,不是吗?我是说{{--$shopsViews--}}哦,我刚刚注意到结尾有必要的破折号。我认为这就像是sql中的破折号一样。
@extends('your_layout_folder.layout')
@section('content')
@foreach ($shopsViews as $shop)
<strong>aaa</strong>
@endforeach
@stop