看下面的代码
<?php
class DefaultController extends Controller
{
    public function actionIndex()
    {
        $this->render('index');
    }
    /**
     * Displays the login page
     */
    public function actionLogin()
    {
        $model = new LoginForm;
        // collect user input data
        if (isset($_POST['LoginForm']))
        {
            $model->attributes = $_POST['LoginForm'];
            // validate user input and redirect to the previous page if valid
            if ($model->validate() && $model->login())
                $this->redirect(Yii::app()->user->returnUrl);
        }
        // display the login form
        $this->render('login', array('model' => $model));
    }
    public function filters()
    {
        return array(
            'accessControl',
        );
    }
    public function accessRules()
    {
        return array(
            array('allow', // allow all users to perform the 'login' action
                'actions' => array('login'),
                'users' => array('*'),
            ),
            array('allow', // allow the admin user to perform everything
                'actions' => array('*'),
                'users' => array('@'),
            ),
            array('deny', // deny all users
                'users' => array('*'),
            ),
        );
    }
}
问题是,当我转到我的模块时:/?r=admin我被重定向到/?r=site/index我的默认站点控制器。
这怎么可能发生?
编辑:(添加 AdminModule)
<?php
class AdminModule extends CWebModule
{
    public function init()
    {
        // this method is called when the module is being created
        // you may place code here to customize the module or the application
        // import the module-level models and components
        $this->setImport(array(
            'admin.models.*',
            'admin.components.*',
        ));
        $this->setComponents(array(
            'user' => array(
                'loginUrl' => Yii::app()->createUrl('admin/default/login'),
            )
        ));
    }
    public function beforeControllerAction($controller, $action)
    {
        if (parent::beforeControllerAction($controller, $action))
        {
            // this method is called before any module controller action is performed
            // you may place customized code here
            return true;
        }
        else
            return false;
    }
}
如您所见,我通过 setComponents 添加了 loginUrl,但这也不起作用。