嗨有下一条路线
Route::get('/{param1}',
'Http\Controllers\SomeController@getCollection');
Route::get('/{param_for_middleware}/{param1}',
'Http\Controllers\SomeController@getCollection');
而且,在我的控制器上,我有
// PSR7 code
use Illuminate\Routing\Controller;
use Psr\Http\Message\ServerRequestInterface;
class SomeController extends Controller
public function getCollection(ServerRequestInterface $request)
{
// here, I need access to param1
dd($request);
}
}
使用原始 Laravel 路由器我们可以通过$this->route()->parameters()['param1]
. 但是,当我们在 Laravel 上使用 PSR7 时呢?