本文整理汇总了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);
}
示例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];
}
}
示例3: addRules
/**
* Adds module rules.
*
* @param Application $app
*/
public function addRules($app)
{
$app->getUrlManager()->addRules([], false);
}
示例4: addFrontendUrlRule
private function addFrontendUrlRule(Application $app)
{
$rules = ['frontend/<layout:\\w+><view:(.*)>' => 'frontend/frontend/render-raw'];
$app->getUrlManager()->addRules($rules);
}
示例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);
}
示例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';
}
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}