2016-05-12 10 views

Antwort

0

können Sie OOP verwenden

Eltern

 class parentController extends Controller 
    { 
     /** 
     * @inheritdoc 
     */ 


     public function actionYourAction() 
     { 
      return $this->render('your_parent_view'); 
     } 

erweitert

 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 
    } 

} 
Verwandte Themen