【发布时间】:2019-02-03 00:33:16
【问题描述】:
你好,这是我的控制器:
public function getValues(Request $request){
$typ=$request->get('typ');
$stellentyp=$request->get('stellentyp');
$bereich=$request->get('bereich');
$view = 'user.'.$stellentyp;
return view($view,['typ' => $typ, 'stellentyp', $stellentyp, 'bereich', $bereich]);
}
我希望用户可以选择一个“stellentyp”,然后应该显示带有该“stellentyp”的视图。
但是我的路线有问题,他们不知道变量“stellentyp”。 如何将我的控制器与我的路由连接?
我试过了
Route::post('user/{$stellentyp}', 'StartController@getValues')->name('user.{$stellentyp}');
但它不起作用:(。错误是:
缺少 [Route: user] [URI: 用户/{$stellentyp}]。 (看法: C:\xampp\htdocs\j4ylara\resources\views\user\start.blade.php)
【问题讨论】:
-
缺少 [Route: user] [URI: user/{$stellentyp}] 的必需参数。 (查看:C:\xampp\htdocs\j4ylara\resources\views\user\start.blade.php)这是错误
-
确保将所有内容都放在问题中,而不是在 cmets 中。您可以编辑已发布的问题。