本文整理汇总了PHP中Phalcon\Mvc\Router::clear方法的典型用法代码示例。如果您正苦于以下问题:PHP Router::clear方法的具体用法?PHP Router::clear怎么用?PHP Router::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Phalcon\Mvc\Router
的用法示例。
在下文中一共展示了Router::clear方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mvcRouter
private function mvcRouter()
{
//Register routing
$router = new Router();
$router->clear();
foreach ($this->config('route') as $url => $route) {
$router->add($url, $route->toArray());
}
return $router;
}
示例2: __construct
/**
* @param Router|null $router
* @param Url|null $url
*/
public function __construct(Router $router = null, Url $url = null)
{
$di = new DI();
$di->setShared('request', new PhalconRequest());
if ($router instanceof PhalconRouterInterface) {
$this->router = $router;
} elseif ($router === null) {
$this->router = new Router();
$this->router->clear();
} else {
throw new Exception\RuntimeException('Router has to be an instance of RouterInterface');
}
$this->router->setDI($di);
$di->setShared('router', $this->router);
if ($url instanceof UrlInterface) {
$this->url = $url;
} elseif ($url === null) {
$this->url = new Url();
$this->url->setBaseUri('/');
} else {
throw new Exception\RuntimeException('Url has to be an instance of UrlInterface');
}
$this->url->setDI($di);
}
示例3: createPhalconRouter
/**
* @return Router
*/
private static function createPhalconRouter()
{
$router = new Router();
$router->clear();
$router->setDi(new FactoryDefault());
return $router;
}
示例4: tearDown
public function tearDown()
{
$this->router->clear();
parent::tearDown();
}
示例5: Router
<?php
use Phalcon\Mvc\Router;
$router = new Router();
$router->clear();
$router->removeExtraSlashes(true);
// Add default route
$router->add("/", array("controller" => "index", "action" => "index"));
// Add 404 route
$router->notFound(array("controller" => "index", "action" => "index"));
// Add route groups
$router->mount(new \Pangea\Routes\AccountRoutes());
$router->mount(new \Pangea\Routes\TownRoutes());
$router->mount(new \Pangea\Routes\RaceRoutes());
return $router;
示例6: clear
public function clear()
{
parent::clear();
}