0
我正在嘗試將變量$ id傳遞給路由文件中的Controller函數。將參數傳遞給laravel中的控制器函數的錯誤
以下是從各個文件片斷:
routes.php文件
Route::get('/news-post/{$id}', '[email protected]');
BlogController.php
public function getPost($id)
{
$post = \App\blog::find($id);
if($post == NULL){
App::abort(404);
}
return View('webpages.news-post',['title'=>$post['title'],'post'=>$post]);
}
我得到在RouteCollection一個NotFoundHttpException。 php line 161:
我試圖尋找原因,但無法找到任何。
請檢查下面的答案。希望它能正常工作 –