简体   繁体   English

如何在yii2框架中使用catchAll组件?

[英]How do use catchAll component in yii2 framwork?

how do use catchAll component in yii2 framwork? 如何在yii2框架中使用catchAll组件?

It gives error, when I am configuring as it described in documentation. 当我按照文档中的说明进行配置时,它给出了错误。

'catchAll' => [
    'site/offline',
    'h' => 2,
],

browser show this message: 浏览器显示以下消息:

The page isn't redirecting properly 页面未正确重定向

Could be you need a $h2 param in your controller/action signature 可能是您的控制器/动作签名中需要一个$h2参数

public function actionOffline($h)
{

   if ($h ==2){
      return $this->render('offline_h2');
   }
   return $this->render('offline');
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM