過去兩天我一直在爲這個問題而苦苦掙扎。最後決定後我的問題:Laravel 4正確地命名了路由路由,但沒有顯示視圖的內容
routes.php文件
Route::get('authors/newAuthors', array('as'=>'new', 'uses'=> '[email protected]'));
控制器(authors.php)
public function newAuthors(){
$value = View::make('authors.newAuthors')
->with('title', 'authors Adding Page');
return $value;
}
index.blade.php(在該視圖中,我有一個鏈接,命名路線「新作者」)應顯示點擊(newAuthors.blade.php後
@extends('layouts.master')
@section('content')
<h2>Authors page from index blade php</h2>
<ul>
@foreach($authors as $author)
<li>{{ HTML::linkRoute('author', $author->name, `array($author['id'])) }}</li>`
@endforeach
</ul>
{{ HTML::linkRoute('new', 'New Authors') }}
@stop
視圖)
@extends('layouts.master')
@section('content')
<h2>Add New Authors</h2>
@stop
當我點擊鏈接(「新作者」)上,在URL它表明我,這是路由到正確的路徑:
http://localhost:8000/authors/newAuthors
但它不顯示任何比賽該視圖文件(newAuthors.blade.php)
link_to_route()...方法在laravel中不再存在4.按照鏈接::: http://stackoverflow.com/questions/16845540/laravel-method-link-to-route-does - 不存在 – score
你是對的SHANKAR。這只是命名路線的一個例子。 – JulianoMartins