首页 文章

Laravel:未找到命名路线

提问于
浏览
0

我在 routes.php 中有以下命名路线:

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

然后,我尝试在另一个视图(404.blade.php)中获取到该路径的链接,基于docs

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

但是,上面带代码的页面显示为: Error in exception handler: Route [home] not defined . 我也试过使用 route('home') .

我错过了什么?

1 回答

  • 2

    syntax for named routes有点不同

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

相关问题