如何从 url 获取多个参数作为 laravel 中的通配符

How to get multiple parameters from url as wildcard in laravel

我试图从 url 获取多个参数并将它们发送给查看,但我得到的是未定义的变量。如何解决这个问题:

api.php

Route::get('adwidth/{width}/adheight/{height}/aduser/{user_id}', function(){
    return view('frame', compact('width','height','user_id'));
});

frame.blade.php

@section('content')
    <h3>{{ $width }}</h3>
@stop

我正在使用 laravel 5.3

我找到了必须将这些参数传递给我的闭包的解决方案,如下所示:

Route::get('adwidth/{width}/adheight/{height}/aduser/{user_id}', function($width, $height, $user_id){
    return view('frame', compact('width','height','user_id'));
});