Adding Rules Dynamically
URL rules can be dynamically added to the URL manager. This is often needed by redistributable modules which want to manage their own URL rules. In order for the dynamically added rules to take effect during the routing process, you should add them during the bootstrapping stage. For modules, this means they should implement yii\base\BootstrapInterface and add the rules in the bootstrap() method like the following:
public function bootstrap($app)
{
$app->getUrlManager()->addRules([
// rule declarations here
], false);
}
Note that you should also list these modules in yii\web\Application::bootstrap() so that they can participate the bootstrapping process.
Написано
Войдите на сайт
Чтобы задать вопрос и получить на него квалифицированный ответ.