本文整理汇总了PHP中Phalcon\Mvc\Router::setDefaultAction方法的典型用法代码示例。如果您正苦于以下问题:PHP Router::setDefaultAction方法的具体用法?PHP Router::setDefaultAction怎么用?PHP Router::setDefaultAction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Phalcon\Mvc\Router
的用法示例。
在下文中一共展示了Router::setDefaultAction方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: function
<?php
use Phalcon\Mvc\Router;
/* ==================================================
* ลงทะเบียน "เส้นทางเว็บแอพพลิเคชั่น" (Router)
* Registering a router
* ================================================== */
$config = $this->config;
// Read the configuration
$manager->set('router', function () use($config) {
$router = new Router();
$router->setDefaultModule($config->router->moduleDefault);
$router->setDefaultController($config->router->controllerDefault);
$router->setDefaultAction($config->router->actionDefault);
$router->removeExtraSlashes(TRUE);
$addModule = explode(',', $config->module->moduleLists);
foreach ($addModule as $module) {
$pathModule = APPLICATION_PATH . '/modules/' . $module . '/Router.php';
$nameModule = ucfirst($module) . 'Router';
if (file_exists($pathModule)) {
include_once $pathModule;
$router->mount(new $nameModule($config));
}
}
return $router;
});
示例2: Router
<?php
use Phalcon\Mvc\Router;
$router = new Router();
//$router = new Router(false);
$router->removeExtraSlashes(true);
// 移除URL多余的斜杠
//$router->setUriSource(Router::URI_SOURCE_GET_URL);
$router->setDefaultController('index');
$router->setDefaultAction('index');
$router->setDefaultModule('frontend');
$router->setDefaultNamespace('Apps\\Frontend\\Controllers');
// APP API
$router->add('/appApi', ['module' => 'appApi', 'namespace' => 'Apps\\AppApi\\Controllers\\', 'controller' => 'index', 'action' => 'index']);
$router->add('/appApi' . '/:action', ['module' => 'appApi', 'namespace' => 'Apps\\AppApi\\Controllers\\', 'controller' => 'index', 'action' => 1]);
$defaultController = 'index';
$defaultAction = 'index';
$urlBase = ['/backend' => ['module' => 'backend', 'namespace' => 'Apps\\Backend\\Controllers\\'], '/manage' => ['module' => 'manage', 'namespace' => 'Apps\\Manage\\Controllers\\'], '/frontend' => ['module' => 'frontend', 'namespace' => 'Apps\\Frontend\\Controllers\\'], '/pay' => ['module' => 'pay', 'namespace' => 'Apps\\Pay\\Controllers\\']];
foreach ($urlBase as $k => $v) {
$module = $v['module'];
$namespace = $v['namespace'];
$router->add($k . '/:params', ['module' => $module, 'namespace' => $namespace, 'controller' => $defaultController, 'action' => $defaultAction, 'params' => 1]);
$router->add($k . '/:controller/:params', ['module' => $module, 'namespace' => $namespace, 'controller' => 1, 'action' => $defaultAction, 'params' => 2]);
$router->add($k . '/:controller/:action/:params', ['module' => $module, 'namespace' => $namespace, 'controller' => 1, 'action' => 2, 'params' => 3]);
}
return $router;
示例3: setDefaultAction
public function setDefaultAction($actionName)
{
return parent::setDefaultAction($actionName);
}