Laravel:未找到命名路线

时间:2014-12-28 18:31:53

标签: laravel routes

我在 routes.php

中有以下命名路线
Route::get('/', 'DefaultController@index', array('as' => 'home'));

然后,我尝试根据docs获取另一个视图中的路径链接(404.blade.php):

<a href="{{URL::route('home')}}">Go to homepage</a>

但是,带有上述代码的页面显示:异常处理程序错误:Route [home]未定义。我也尝试使用route('home')

我错过了什么?

1 个答案:

答案 0 :(得分:2)

syntax for named routes有点不同

Route::get('/', array('as' => 'home', 'uses' => 'DefaultController@index'));