本文整理汇总了PHP中Map::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP Map::getInstance方法的具体用法?PHP Map::getInstance怎么用?PHP Map::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Map
的用法示例。
在下文中一共展示了Map::getInstance方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: recognize
/**
* Recognize a Route Based on the Request.
*
* @param Request request the Request
* @return ActionController
* @throws RoutingEception
*/
public static function recognize(Request $request)
{
$r = new ActionControllerRouting($request);
try {
$route = $r->findRoute($request);
return $route->createControllerInstance($request);
} catch (RoutingException $rEx) {
// exception thrown by findRoute if we dont match any of the registered route.
// load 404 route, if fails too try the default route, this are named routes.
// echo $rEx;
try {
return Map::getInstance()->getRouteByName(Route::NOTFOUND)->createControllerInstance($request);
} catch (RoutingException $rEx2) {
return Map::getInstance()->getRouteByName(Route::WELCOME)->createControllerInstance($request);
}
}
}
示例2: Route
<?php
// $Id$
$map = Map::getInstance();
$map->add(new Route(':controller/:action/:id'));