当前位置: 首页>>代码示例>>PHP>>正文


PHP Application::getUrlManager方法代码示例

本文整理汇总了PHP中yii\base\Application::getUrlManager方法的典型用法代码示例。如果您正苦于以下问题:PHP Application::getUrlManager方法的具体用法?PHP Application::getUrlManager怎么用?PHP Application::getUrlManager使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在yii\base\Application的用法示例。


在下文中一共展示了Application::getUrlManager方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: registerRules

 /**
  * @param \yii\base\Application $app
  */
 public function registerRules($app)
 {
     $app->getUrlManager()->addRules(['<language:\\w+\\-\\w+>/cp/' . $this->id => 'cp/' . $this->id, '<language:\\w+\\-\\w+>/cp/' . $this->id . '/<controller:\\w+>' => 'cp/' . $this->id . '/<controller>', '<language:\\w+\\-\\w+>/cp/' . $this->id . '/<controller:\\w+>/<action:\\w+>' => 'cp/' . $this->id . '/<controller>/<action>'], false);
     /**
      * magic/default/download.html?id=1
      * ru-RU/magic/default/download.html?id=1
      */
     $app->getUrlManager()->addRules([$this->id . '/<controller:\\w+>/<action:\\w+>' => $this->id . '/<controller>/<action>', '<language:\\w+\\-\\w+>/' . $this->id . '/<controller:\\w+>/<action:\\w+>' => $this->id . '/<controller>/<action>'], false);
 }
开发者ID:apurey,项目名称:cmf,代码行数:12,代码来源:Bootstrap.php

示例2: addUrlRules

 /**
  * Add default url rules of this module to custom urlManager of application
  * @param \yii\base\Application $app
  */
 public function addUrlRules(\yii\base\Application $app)
 {
     if ($app instanceof \yii\web\Application) {
         $app->getUrlManager()->addRules([['prefix' => $this->urlRulePrefix, 'class' => $this->urlRuleClass, 'controller' => [$this->id . '/user'], 'extraPatterns' => ['POST current' => 'current', 'POST extend' => 'extend'], 'pluralize' => false]]);
     } elseif ($app instanceof \yii\console\Application) {
         $app->controllerMap[$this->id] = ['class' => 'gbksoft\\modules\\tokens\\console\\AppController', 'module' => $this];
     }
 }
开发者ID:gbksoft,项目名称:yii2-tokens,代码行数:12,代码来源:Module.php

示例3: addRules

 /**
  * Adds module rules.
  *
  * @param Application $app
  */
 public function addRules($app)
 {
     $app->getUrlManager()->addRules([], false);
 }
开发者ID:manyoubaby123,项目名称:imshop,代码行数:9,代码来源:Bootstrap.php

示例4: addFrontendUrlRule

 private function addFrontendUrlRule(Application $app)
 {
     $rules = ['frontend/<layout:\\w+><view:(.*)>' => 'frontend/frontend/render-raw'];
     $app->getUrlManager()->addRules($rules);
 }
开发者ID:degordian,项目名称:yii2-frontend-controller,代码行数:5,代码来源:RouteBootstrap.php

示例5: bootstrap

 /**
  * Bootstrap method to be called during application bootstrap stage.
  *
  * @param Application $app the application currently running
  */
 public function bootstrap($app)
 {
     $app->getUrlManager()->addRules([['pattern' => $this->id, 'route' => $this->id . '/default/index', 'suffix' => '.xml'], ['pattern' => $this->id . '/<type:[\\w-@]+>/<slug:[\\w-@]+>-<page:\\d+>', 'route' => $this->id . '/default/view', 'suffix' => '.xml'], ['pattern' => $this->id . '/<type:[\\w-@]+>/<slug:[\\w-@]+>', 'route' => $this->id . '/default/view', 'suffix' => '.xml'], $this->id => '/site/not-found', $this->id . '/default/' => '/site/not-found', $this->id . '/default/<alias:index|view>/' => '/site/not-found'], false);
 }
开发者ID:tampaphp,项目名称:app-cms,代码行数:9,代码来源:Module.php

示例6: bootstrap

 /**
  * Bootstrap method to be called during application bootstrap stage.
  * Adding routing rules and log target.
  * 
  * @param \yii\base\Application $app the application currently running
  */
 public function bootstrap($app)
 {
     if ($app instanceof WebApplication) {
         $app->getUrlManager()->addRules([new GroupUrlRule(['prefix' => 'podium', 'rules' => ['activate/<token:[\\w\\-]+>' => 'account/activate', 'admin/ban/<id:\\d+>' => 'admin/ban', 'admin/contents/<name:[\\w\\-]+>' => 'admin/contents', 'admin/delete/<id:\\d+>' => 'admin/delete', 'admin/delete-category/<id:\\d+>' => 'admin/delete-category', 'admin/delete-forum/<cid:\\d+>/<id:\\d+>' => 'admin/delete-forum', 'admin/edit-category/<id:\\d+>' => 'admin/edit-category', 'admin/edit-forum/<cid:\\d+>/<id:\\d+>' => 'admin/edit-forum', 'admin/forums/<cid:\\d+>' => 'admin/forums', 'admin/mod/<uid:\\d+>/<fid:\\d+>' => 'admin/mod', 'admin/mods/<id:\\d+>' => 'admin/mods', 'admin/new-forum/<cid:\\d+>' => 'admin/new-forum', 'admin/pm/<id:\\d+>' => 'admin/pm', 'admin/update/<id:\\d+>' => 'admin/update', 'admin/view/<id:\\d+>' => 'admin/view', 'admin' => 'admin/index', 'category/<id:\\d+>/<slug:[\\w\\-]+>' => 'default/category', 'delete/<cid:\\d+>/<fid:\\d+>/<id:\\d+>/<slug:[\\w\\-]+>' => 'default/delete', 'deletepost/<cid:\\d+>/<fid:\\d+>/<tid:\\d+>/<pid:\\d+>' => 'default/deletepost', 'deleteposts/<cid:\\d+>/<fid:\\d+>/<id:\\d+>/<slug:[\\w\\-]+>' => 'default/deleteposts', 'demote/<id:\\d+>' => 'admin/demote', 'edit/<cid:\\d+>/<fid:\\d+>/<tid:\\d+>/<pid:\\d+>' => 'default/edit', 'forum/<cid:\\d+>/<id:\\d+>/<slug:[\\w\\-]+>' => 'default/forum', 'home' => 'default/index', 'install' => 'install/run', 'last/<id:\\d+>' => 'default/last', 'lock/<cid:\\d+>/<fid:\\d+>/<id:\\d+>/<slug:[\\w\\-]+>' => 'default/lock', 'login' => 'account/login', 'logout' => 'profile/logout', 'members/posts/<id:\\d+>/<slug:[\\w\\-]+>' => 'members/posts', 'members/threads/<id:\\d+>/<slug:[\\w\\-]+>' => 'members/threads', 'members/view/<id:\\d+>/<slug:[\\w\\-]+>' => 'members/view', 'members' => 'members/index', 'members/ignore/<id:\\d+>' => 'members/ignore', 'messages/delete/<id:\\d+>' => 'messages/delete', 'messages/new/<user:\\d+>' => 'messages/new', 'messages/reply/<id:\\d+>' => 'messages/reply', 'messages/view/<id:\\d+>' => 'messages/view', 'move/<cid:\\d+>/<fid:\\d+>/<id:\\d+>/<slug:[\\w\\-]+>' => 'default/move', 'moveposts/<cid:\\d+>/<fid:\\d+>/<id:\\d+>/<slug:[\\w\\-]+>' => 'default/moveposts', 'new-email/<token:[\\w\\-]+>' => 'account/new-email', 'new-thread/<cid:\\d+>/<fid:\\d+>' => 'default/new-thread', 'pin/<cid:\\d+>/<fid:\\d+>/<id:\\d+>/<slug:[\\w\\-]+>' => 'default/pin', 'post/<cid:\\d+>/<fid:\\d+>/<tid:\\d+>/<pid:\\d+>' => 'default/post', 'post/<cid:\\d+>/<fid:\\d+>/<tid:\\d+>' => 'default/post', 'profile' => 'profile/index', 'profile/add/<id:\\d+>' => 'profile/add', 'profile/delete/<id:\\d+>' => 'profile/delete', 'profile/mark/<id:\\d+>' => 'profile/mark', 'promote/<id:\\d+>' => 'admin/promote', 'reactivate' => 'account/reactivate', 'register' => 'account/register', 'report/<cid:\\d+>/<fid:\\d+>/<tid:\\d+>/<pid:\\d+>/<slug:[\\w\\-]+>' => 'default/report', 'reset' => 'account/reset', 'rss' => 'default/rss', 'search' => 'default/search', 'show/<id:\\d+>' => 'default/show', 'thread/<cid:\\d+>/<fid:\\d+>/<id:\\d+>/<slug:[\\w\\-]+>' => 'default/thread']])], false);
         $dbTarget = new DbTarget();
         $dbTarget->logTable = '{{%podium_log}}';
         $dbTarget->categories = ['bizley\\podium\\*'];
         $dbTarget->logVars = [];
         $app->getLog()->targets['podium'] = $dbTarget;
     } elseif ($app instanceof ConsoleApplication) {
         $this->controllerNamespace = 'bizley\\podium\\console';
     }
 }
开发者ID:keltstr,项目名称:yii2-podium,代码行数:19,代码来源:Module.php

示例7: addRules

 /**
  * Adds module rules.
  *
  * @param Application $app
  */
 public function addRules($app)
 {
     $app->getUrlManager()->addRules([['class' => 'yii\\rest\\UrlRule', 'prefix' => 'api/v1', 'extraPatterns' => ['GET,HEAD roots' => 'roots', 'GET,HEAD leaves' => 'leaves', 'GET,HEAD {id}/children' => 'children', 'GET,HEAD {id}/descendants' => 'descendants', 'GET,HEAD {id}/leaves' => 'leaves', 'GET,HEAD {id}/ancestors' => 'ancestors', 'GET,HEAD {id}/parent' => 'parent', 'PUT,PATCH {id}/move' => 'move', 'POST search' => 'search'], 'controller' => ['categories' => 'catalog/rest/category', 'product-categories' => 'catalog/rest/product-category']], ['class' => 'yii\\rest\\UrlRule', 'prefix' => 'api/v1', 'extraPatterns' => ['GET,HEAD {id}/attributes' => 'attributes'], 'controller' => ['product-types' => 'catalog/rest/product-type']]], false);
 }
开发者ID:xyxdasnjss,项目名称:imshop,代码行数:9,代码来源:Bootstrap.php

示例8: bootstrap

 /**
  * Ajout du routing spécifique au module
  *      format : [verbe] regex-url => route
  *
  * @param \yii\base\Application $app
  */
 public function bootstrap($app)
 {
     $app->getUrlManager()->addRules(include __DIR__ . '/config/routing.php', false);
 }
开发者ID:ChristopheBrun,项目名称:hLib,代码行数:10,代码来源:HCms.php

示例9: bootstrap

 /**
  * Ajout du routing spécifique au module
  *      format : [verbe] regex-url => route
  *
  * @param \yii\base\Application $app
  */
 public function bootstrap($app)
 {
     $app->getUrlManager()->addRules(['GET    hlib/admin' => 'hlib/admin/index'], false);
 }
开发者ID:ChristopheBrun,项目名称:hLib,代码行数:10,代码来源:HLib.php

示例10: bootstrap

 /**
  * @param \yii\base\Application $app
  */
 public function bootstrap($app)
 {
     $app->getUrlManager()->addRules(['GET /' => 'site/home/home', 'GET,POST login' => 'site/auth/login', 'GET logout' => 'site/auth/logout'], true);
 }
开发者ID:quantum13,项目名称:yii2tests,代码行数:7,代码来源:Module.php

示例11: addRules

 /**
  * Adds module rules.
  *
  * @param Application $app
  */
 public function addRules($app)
 {
     $app->getUrlManager()->addRules([['class' => 'yii\\rest\\UrlRule', 'prefix' => 'api/v1', 'extraPatterns' => ['GET,HEAD roots' => 'roots', 'GET,HEAD leaves' => 'leaves', 'GET,HEAD {id}/children' => 'children', 'GET,HEAD {id}/descendants' => 'descendants', 'GET,HEAD {id}/leaves' => 'leaves', 'GET,HEAD {id}/ancestors' => 'ancestors', 'GET,HEAD {id}/parent' => 'parent', 'PUT,PATCH {id}/move' => 'move', 'POST search' => 'search'], 'controller' => ['menu-items' => 'cms/rest/menu-item']], ['class' => 'yii\\rest\\UrlRule', 'prefix' => 'api/v1', 'extraPatterns' => ['GET,HEAD {id}/items/roots' => 'roots', 'POST {id}/items/search' => 'search'], 'controller' => ['menus' => 'cms/rest/menu']]], false);
 }
开发者ID:manyoubaby123,项目名称:imshop,代码行数:9,代码来源:Bootstrap.php


注:本文中的yii\base\Application::getUrlManager方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。