我是laravel框架的新手,我正在尝试创建CRUD。问题是视图中使用的标记显示为字符串。我正在关注this教程。
<body>
<div class="container">
<nav class="navbar navbar-inverse">
<ul class="nav navbar-nav">
<li><a href="{{ URL::to('customers') }}">View All Customers</a></li>
<li><a href="{{ URL::to('nerds/create') }}">Create a Customer</a>
</ul>
</nav>
<h1>Create a Customer</h1>
<!-- if there are creation errors, they will show here -->
{{ HTML::ul($errors->all()) }}
{{ Form::open(array('url' => 'nerds')) }}
<div class="form-group">
{{ Form::label('name', 'Name') }}
{{ Form::text('name', Input::old('name'), array('class' => 'form-control')) }}
</div>
<div class="form-group">
{{ Form::label('email', 'Email') }}
{{ Form::email('email', Input::old('email'), array('class' => 'form-control')) }}
</div>
{{ Form::submit('Create the Customer!', array('class' => 'btn btn-primary')) }}
{{ Form::close() }}
</div>
</body>
它显示:
{{ HTML::ul($errors->all()) }} {{ Form::open(array('url' => 'nerds')) }}
{{ Form::label('name', 'Name') }} {{ Form::text('name', Input::old('name'), array('class' => 'form-control')) }}
{{ Form::label('email', 'Email') }} {{ Form::email('email', Input::old('email'), array('class' => 'form-control')) }}
{{ Form::submit('Create the Customer!', array('class' => 'btn btn-primary')) }} {{ Form::close() }}
答案 0 :(得分:1)
确保视图文件扩展名为.blade.php
,而不仅仅是.php