How can create BaseController extends Controller in Yii 2
问题 As title, I would create custom controller and overwrite core controller in Yii 2, and bellow is my code. / create BaseController, I put this file in root/components. / namespace yii\base; use Yii; class BaseController extends \Controller{ public function init() { parent::init(); } } /* Extends BaseController.*/ namespace app\components; use Yii; class UsersController extends \BaseController { /* more function is here.*/ public actionIndex(){ echo _FUNCTION_; } } I change more way, but this