如果//routes.phpRoute::get('user/{name}', 'UserController@index');那么在控制器中://UserController.phppublic function index($name){echo $name;}注意,这个时候你设置 $name = xxx 是没有意义的,因为$name不可能为空,直接访问 /user 的话,是一个未定义的路由。