0
A
回答
0
您可以使用OOP
家長
class parentController extends Controller
{
/**
* @inheritdoc
*/
public function actionYourAction()
{
return $this->render('your_parent_view');
}
擴展
class yourController extends parentController
{
/**
* @inheritdoc
*/
public function actionYourAction()
{
return $this->render('your_view');
}
0
CommonController.php
<?php
namespace app\controllers;
use Yii;
use yii\web\Controller;
use yii\web\ForbiddenHttpException;
class CommonController extends Controller
{
public actionIndex(){
//Codes
}
}
UsersController
<?php
use app\controllers\CommonController; //Give correct path here
class UsersController extends CommonController
{
public actionIndex(){
//Codes
}
}