【发布时间】:2013-03-08 04:56:09
【问题描述】:
读symfony/路由readme:
// ...
$context = new RequestContext();
// this is optional and can be done without a Request instance
$context->fromRequest(Request::createFromGlobals());
$matcher = new UrlMatcher($routes, $context);
它是可选的是什么意思?没有它,Matcher 功能会受到某种限制吗? matcher如何使用Request对象?
编辑
我发现 RouteListener 负责使用当前请求信息(主机、方法等)更新上下文。因此,当通过事件调度程序完成路由匹配时,不需要此可选步骤。
【问题讨论】: