本文整理汇总了PHP中Phalcon\Mvc\Router::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP Router::__construct方法的具体用法?PHP Router::__construct怎么用?PHP Router::__construct使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Phalcon\Mvc\Router
的用法示例。
在下文中一共展示了Router::__construct方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct()
{
parent::__construct(false);
$this->add('/admin', ['module' => 'backend', 'controller' => 'index', 'action' => 'index']);
$this->add('/index', ['module' => 'frontend', 'controller' => 'index', 'action' => 'index']);
$this->add('/', ['module' => 'frontend', 'controller' => 'index', 'action' => 'index']);
}
示例2: __construct
public function __construct()
{
parent::__construct();
$this->setDefaultController('index');
$this->setDefaultAction('index');
$this->add('/:module/:controller/:action/:params', ['module' => 1, 'controller' => 2, 'action' => 3, 'params' => 4])->setName('default');
$this->add('/:module/:controller', ['module' => 1, 'controller' => 2, 'action' => 'index'])->setName('default_action');
$this->add('/:module', ['module' => 1, 'controller' => 'index', 'action' => 'index'])->setName('default_controller');
}
示例3: __construct
public function __construct(DiInterface $di)
{
parent::__construct(false);
$this->clear();
$this->removeExtraSlashes(true);
$this->setUriSource(PhalconRouter::URI_SOURCE_SERVER_REQUEST_URI);
$this->setDefaultAction('index');
$this->setDefaultController('index');
$this->setDI($di);
$this->notFound(['controller' => 'error', 'action' => 'not-found']);
}
示例4: __construct
public function __construct()
{
parent::__construct();
$this->setDefaultController('index');
$this->setDefaultAction('index');
// $this->setDefaultModule("admin");
$this->add('/:module/:controller/:action/:params', ['module' => 1, 'controller' => 2, 'action' => 3, 'params' => 4])->setName('default');
$this->add('/:module/:controller', ['module' => 1, 'controller' => 2, 'action' => 'index'])->setName('default_action');
$this->add('/:module', ['module' => 1, 'controller' => 'index', 'action' => 'index'])->setName('default_controller');
//暂时使用后台管理当首页
$this->add('/', ['module' => 'admin', 'controller' => 'index', 'action' => 'index'])->setName('default_controller');
$this->removeExtraSlashes(true);
}
示例5: __construct
public function __construct()
{
parent::__construct(false);
static::$runningUnitTest = Config::runningUnitTest();
// @codeCoverageIgnoreStart
if ($this->_sitePathPrefix = Config::get('app.site_path')) {
$this->_uriSource = self::URI_SOURCE_GET_URL;
$this->_sitePathLength = strlen($this->_sitePathPrefix);
}
// @codeCoverageIgnoreEnd
$this->removeExtraSlashes(true);
$routes = is_file($file = $_SERVER['PHWOOLCON_ROOT_PATH'] . '/app/routes.php') ? include $file : [];
is_array($routes) and $this->addRoutes($routes);
$this->cookies = static::$di->getShared('cookies');
$this->response = static::$di->getShared('response');
$this->response->setStatusCode(200);
}
示例6: __construct
public function __construct()
{
parent::__construct();
$session = \Phalcon\DI::getDefault()->getSession();
//Set the default namespace for all controllers that doesn't match our custom routes
//e.g '/auth/login' will route to something like 'MyApp\Controllers\AuthController::loginAction()'
$this->setDefaultNamespace('PRIME\\Controllers\\');
//Our custom routes will not use slashes at the of the URIs
$this->removeExtraSlashes(true);
if ($session->has("auth")) {
//Retrieve its value
$auth = $session->get("auth");
$this->theme = $auth['theme'];
$directory = '../app/themes/' . $this->theme . '/widgets/';
//get all files in specified directory
$files = glob($directory . "*", GLOB_ONLYDIR);
$files = array_map('basename', $files);
$this->themeLevel2SetupNamespacedRoutes("widgets", $files);
$directory = '../app/authenticators/';
//get all files in specified directory
$files = glob($directory . "*", GLOB_ONLYDIR);
$files = array_map('basename', $files);
$this->level2SetupNamespacedRoutes("authenticators", $files);
$directory = '../app/form_elements/';
//get all files in specified directory
$files = glob($directory . "*", GLOB_ONLYDIR);
$files = array_map('basename', $files);
$this->level2SetupNamespacedRoutes("form_elements", $files);
$directory = '../app/data_connectors/';
//get all files in specified directory
$files = glob($directory . "*", GLOB_ONLYDIR);
$files = array_map('basename', $files);
$this->level2SetupNamespacedRoutes("data_connectors", $files);
$directory = '../app/themes/' . $this->theme . '/portlets/';
$this->themeLevel1SetupNamespacedRoutes("portlets");
$directory = '../app/themes/' . $this->theme . '/dashboards/';
$this->themeLevel1SetupNamespacedRoutes("dashboards");
$directory = '../app/themes/' . $this->theme . '/logins/';
$this->themeLevel1SetupNamespacedRoutes("logins");
}
}
示例7: __construct
/**
* myRouter constructor.
*/
public function __construct($defaultRoutes = true)
{
parent::__construct($defaultRoutes);
}
示例8: __construct
public function __construct($bool)
{
parent::__construct($bool);
}
示例9: __construct
/**
* Standard router constructor
*
* @param DiInterface $dependencyInjector
* @param bool $keepDefaultRoutes
*/
public function __construct(DiInterface $dependencyInjector, $keepDefaultRoutes = false)
{
parent::__construct($keepDefaultRoutes);
$this->removeExtraSlashes(true);
$this->setDI($dependencyInjector);
}
示例10: __construct
public function __construct(array $routes, $defaultRoute = false)
{
parent::__construct(false);
$this->setUriSource(static::URI_SOURCE_SERVER_REQUEST_URI);
$this->routes = $routes;
}
示例11: __construct
public function __construct()
{
parent::__construct(false);
$this->removeExtraSlashes(true);
}
示例12: __construct
public function __construct($defaultRoutes = null, ILangService $lang = null)
{
$this->lang = $lang;
parent::__construct($defaultRoutes);
}
示例13: __construct
/**
* Create a new extended Phalcon router.
*
* @param boolean $default
* @param boolean $removeExtraSlashes
*/
public function __construct($default = false, $removeExtraSlashes = true)
{
parent::__construct($default);
$this->removeExtraSlashes($removeExtraSlashes);
}