【发布时间】:2015-01-14 02:54:51
【问题描述】:
您好,我在学习 laravel 和 mvc 的书中有这段代码
Route::model('cat', 'Cat');
Route::get('cats/test', function()
{
return "test_working";
});
Route::get('cats/{cat}', function(Cat $cat) {
return View::make('cats.single')
->with('cat', $cat);
});
Route::get('cats/create', function() {
$cat = new Cat;
return View::make('cats.edit')
->with('cat', $cat)
->with('method', 'post');
});
如果第 2 条路由在第 3 条,则丢弃 NotFoundHttpException 我知道它与猫/{cat} 和模型有关,有人可以解释它为什么会发生 当然我可以移动代码,但我想知道为什么。谢谢。
【问题讨论】:
-
抛出异常的 URL 是什么?
-
Route::get('cats/create', function()...
标签: php laravel laravel-routing