Yii模块无法正常工作

时间:2014-12-17 05:15:25

标签: php yii module

这里我使用三个控制器TestController extends TestBaseControllerTestBaseController extends AdminController

的TestController

<?php
class TestController extends TestBaseController{
    public function accessRules(){
        return array(
            array('allow',  // allow all users to perform following actions
                'actions'=>array('index'),
                'users'=>array('*'),
            ),
        );
    }
    public function actionIndex(){
        @$url = Yii::app()->getBaseUrl()."/test/index";
        //$data=array('messages'=>$postMissing,'models'=>$models);
        $data= '';
        $this->render('index',$data);
    }
}

TestBaseContoller

<?php
class TestBaseController extends AdminController{

    /**
    * override needed to check if its ajax, the redirect will be javascript
    */  
    public $baseURI ;

    public $themBaseUrI;

    public function init() {
        $this->baseURI = Yii::app()->getBaseUrl(false);
        $this->themBaseUrl = Yii::app()->theme->baseUrl;
        //   $this->changeURI();
        parent::init();
    }
}

配置/ main.php

'modules'=>array(
    'test'=>array(  
    ),
),

如何为这些模块传递网址..请帮助我......谢谢

1 个答案:

答案 0 :(得分:0)

如果我正确理解您的问题 - 答案是:可以使用路径 moduleID / controllerID / actionID 访问模块中的控制器操作。