Php Laravel 4.1,使用雄辩时的白色空白屏幕
我是使用Laravel的新手,需要帮助。为什么当我想使用雄辩的语言时,白色屏幕出现在我的网络浏览器中。下面的代码(很抱歉发了这么长的帖子,我想说清楚): php(Controller)Php Laravel 4.1,使用雄辩时的白色空白屏幕,php,laravel-4,Php,Laravel 4,我是使用Laravel的新手,需要帮助。为什么当我想使用雄辩的语言时,白色屏幕出现在我的网络浏览器中。下面的代码(很抱歉发了这么长的帖子,我想说清楚): php(Controller) 当您定义节时,您可以告诉blade如何以及何时显示这些节,您可以使用关闭指令,如@stop、@show、@overwrite等来执行此操作 @stop表示您定义了一个节供以后使用(意味着它不显示),以便以后可以使用它或被另一个节覆盖。要使用存储的节,可以使用@yield('sectionName') 因此,如果您
当您定义节时,您可以告诉blade如何以及何时显示这些节,您可以使用关闭指令,如@stop
、@show
、@overwrite
等来执行此操作
@stop
表示您定义了一个节供以后使用(意味着它不显示),以便以后可以使用它或被另一个节覆盖。要使用存储的节,可以使用@yield('sectionName')
因此,如果您希望在每个页面中都有一个总体布局,比如页脚,您可以通过替换某些部分,继续使用@extends('view')
:
{{--this is layout.blade.php--}}
@yield('content')
<div>My awesome footer</div>
{--layout.blade.php--}
@产量(‘含量’)
我很棒的页脚
您可以这样创建单独的视图:
{{--this is contact.blade.php--}}
@extends('layout')
@section('content')
<div>Contact me: someMail@dem.mails</div>
@stop
{--contact.blade.php--}
@扩展('布局')
@节(“内容”)
联系我:someMail@dem.mails
@停止
@yield
将负责“屈服”(显示)您的部门。这个想法是,您可以决定哪些部分包含以及在不同时刻显示在哪里
如果您想@生成刚才定义的部分,该怎么办?这就是@show
的目的
这是一个链接,指向一本很棒的在线书籍中关于拉威尔的刀锋模板制作的章节,我发现它比官方文档更友好、更深入。玩得开心,尽情地编写代码。您是否已将调试模式设置为true?@JSelser当然,我已设置为trueTry,为@show
@JSelser更改las@stop
,一切正常!之后改为显示。谢谢先生,但请你能解释一下吗?当然,我会发布一个回复。非常感谢先生!还有一个很棒的链接引用,请帮我回答下一个关于模板制作的问题:我曾试图找出使用布局模式进行模板制作的方法,但出现了一些问题
@section('main')
<h1>All Users</h1>
<p>{{ link_to_route('users.create', 'Add new user') }}</p>
@if ($users->count())
<table class="table table-striped table-bordered">
<thead>
<tr>
<th>Username</th>
<th>Password</th>
<th>Email</th>
<th>Phone</th>
<th>Name</th>
</tr>
</thead>
<tbody>
@foreach ($users as $user)
<tr>
<td>{{ $user->username }}</td>
<td>{{ $user->password }}</td>
<td>{{ $user->email }}</td>
<td>{{ $user->phone }}</td>
<td>{{ $user->name }}</td>
<td>{{ link_to_route('users.edit', 'Edit',
array($user->id), array('class' => 'btn btn-info')) }}</td>
<td>
{{ Form::open(array('method'
=> 'DELETE', 'route' => array('users.destroy', $user->id))) }}
{{ Form::submit('Delete', array('class'
=> 'btn btn-danger')) }}
{{ Form::close() }}
</td>
</tr>
@endforeach
</tbody>
</table>
@else
There are no users
@endif
@stop
{{--this is layout.blade.php--}}
@yield('content')
<div>My awesome footer</div>
{{--this is contact.blade.php--}}
@extends('layout')
@section('content')
<div>Contact me: someMail@dem.mails</div>
@stop