本文整理匯總了PHP中zibo\core\Zibo::getRouter方法的典型用法代碼示例。如果您正苦於以下問題:PHP Zibo::getRouter方法的具體用法?PHP Zibo::getRouter怎麽用?PHP Zibo::getRouter使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類zibo\core\Zibo
的用法示例。
在下文中一共展示了Zibo::getRouter方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: route
/**
* Gets a request from the provided path for request chaining
* @param string $path The path to route
* @return zibo\core\Request|null A request if the path was found, null otherwise
*/
protected function route($path)
{
$router = $this->zibo->getRouter();
if (!$router) {
return null;
}
return $router->getRequest($this->request->getBaseUrl(), $path);
}
示例2: getRoutes
/**
* Gets all the routes from Zibo
* @param zibo\core\Zibo $zibo Instance of Zibo
* @return array Array with the route as key and a Route object as value
*/
private function getRoutes(Zibo $zibo)
{
$router = $zibo->getRouter();
$routes = $router->getRoutes();
ksort($routes);
return $routes;
}
示例3: setDefaultAction
/**
* Sets the default action and controller to the router
* @param zibo\core\Zibo $zibo
* @return null
*/
private function setDefaultAction(Zibo $zibo)
{
$router = $zibo->getRouter();
if ($router === null) {
$router = new GenericRouter();
$zibo->setRouter($router);
}
if (!$router instanceof GenericRouter) {
return;
}
$defaultController = $router->getDefaultController();
if ($defaultController) {
return;
}
$defaultController = $zibo->getConfigValue(self::CONFIG_CONTROLLER_DEFAULT, self::CONTROLLER_DEFAULT);
$router->setDefaultAction($defaultController);
}