没有办法做到这一点。
指定的 path 直接传递为 RequestMatcher 的 $path 论点。
path
RequestMatcher
$path
访问映射条目在此处注册到访问映射中: https://github.com/symfony/symfony/blob/master/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php#L165-187
使用使用此方法创建的请求匹配器: https://github.com/symfony/symfony/blob/master/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php#L539-561
如果你看一下 RequestMatcher 的代码,你看它没有耦合到任何路由系统: https://github.com/symfony/symfony/blob/master/src/Symfony/Component/HttpFoundation/RequestMatcher.php