如何使用override/extend
methods
命名空间\Yii::$classMap
我希望override/extend
使用beforeAction($action)
yii\base\Controller
方法,就像这样。
namespace yii\web;
class Controller extends \yii\web\Controller
{
public function beforeAction($action)
{
return parent::beforeAction($action);
}
// Here all the parent methods in \yii\web\Controller should be available
}
现在在backend/web/index.php
\Yii::$classMap['yii\web\Controller'] = '@common/classMaps/Controller.php';
现在在backend/controllers/MyController
,
namespace backend/controllers;
class MyController extends \yii\web\Controller
{
public function actionIndex()
{
}
}
应该如何做?