我試圖加載我創建視圖,加載錯誤觀點5
public function create()
{
//
return View('my.create');
}
,但我有這個錯誤,
FatalErrorException在85b8c1799c6cd6f2475229a36bc0e59a39b0e295.php線23:類 'HTML'沒有找到
create.blade.php
<!DOCTYPE html>
<html>
<head>
<title>Look! I'm CRUDding</title>
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css">
</head>
<body>
<div class="container">
<nav class="navbar navbar-inverse">
<div class="navbar-header">
<a class="navbar-brand" href="{{ URL::to('nerds') }}">Nerd Alert</a>
</div>
<ul class="nav navbar-nav">
<li><a href="{{ URL::to('nerds') }}">View All Nerds</a></li>
<li><a href="{{ URL::to('nerds/create') }}">Create a Nerd</a>
</ul>
</nav>
<h1>Create a Nerd</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>
<div class="form-group">
{{ Form::label('nerd_level', 'Nerd Level') }}
{{ Form::select('nerd_level', array('0' => 'Select a Level', '1' => 'Sees Sunlight', '2' => 'Foosball Fanatic', '3' => 'Basement Dweller'), Input::old('nerd_level'), array('class' => 'form-control')) }}
</div>
{{ Form::submit('Create the Nerd!', array('class' => 'btn btn-primary')) }}
{{ Form::close() }}
</div>
</body>
</html>
上述視圖位於iwn目錄中,稱爲my。我在WAMP服務器中使用Laravel 5.2。
請發表您的看法代碼。 – Laerte
您必須使用Composer.json來安裝HTML,默認情況下,laravel中未安裝HTML –
控制器是否屬於這一部分? Laravel擁有MVC。您需要設置一個控制器,檢查您的路線,然後創建並加載視圖。 – jjwdesign