【发布时间】:2017-03-05 06:42:08
【问题描述】:
有点奇怪的问题,这可能是因为我正在使用 Laravel。
我有一个编辑页面,可通过以下方式访问:
Route::get('editRow/{id}', function($id){
$section = App\Section::where('id', $id)->with('panels')->first();
return view('front.editrow',['thesection'=>$section]);
});
这个表格然后被完成并进入一个带有 longish 方法的控制器来更新表格,并以:
return view('front.editrow',['message'=>'update successful','id'=>$request->id]);
数据库更新正常。最初我遇到了一个错误,所以我复制了路线并将其从 get 更改为 post:
Route::post('editRow/{id}', function($id){
$section = App\Section::where('id', $id)->with('panels')->first();
return view('front.editrow',['thesection'=>$section]);
});
现在虽然这是完全相同的参数等,但我总是得到;
Undefined variable: thesection
我很困惑,如果能解开这个谜团,我将不胜感激!
【问题讨论】:
标签: php laravel variables laravel-5 routing