qiaotouhe 2012-07-09 14:33:36 3200次浏览 5条回复 0 0 0

用Yii做了个CMS,后台登陆 火狐和谷歌登陆都没有问题。

IE和360 登陆不了。

跟踪发现, 可以进入跳转。

public function actionIndex()
{
    $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())
        {
            echo 'go to';
            exit;
            $this->redirect(array('index/manage'));
            //$this->redirect(Yii::app()->user->returnUrl);
        }
    }

    $this->renderPartial('index',array('model'=>$model));
}

去掉上面红色文字后的exit。 西面是manage ,发现没有 输出。怎么回事 ???

/**
 * Displays the manage page
 */
public function actionManage()
{
    echo 'manage';
    exit;
    $this->renderPartial('manage');
}

验证规则

 /**
 * Specifies the access control rules.
 * This method is used by the 'accessControl' filter.
 * @return array access control rules
 */
public function accessRules()
{
    return array(
        array('allow', // allow authenticated users to access all actions
            'actions'=>array('index','captcha'),
            'users'=>array('*'),
        ),
        array('allow', 
            'actions'=>array('manage','top','left','foot','change','changepwd','logout'),
            'users'=> array('@'),
            //'roles' => array('Administrator','Authority') 
        ),
        array('deny',  
            'users'=>array('*'),
        ),
    );
}
  • 回复于 2012-07-09 16:23 举报

    去掉exit;试试

  • 回复于 2012-07-09 17:20 举报

    去掉echo 'go to';
    exit; 后。 manage这个action里面还是进不来。很奇怪

  • 回复于 2012-07-10 16:35 举报

    不知道 echo 'go to'; 输出了么?
    看看 $model->getErrors();有输出么

  • 回复于 2012-07-10 16:37 举报

    额。。 少看了一句话。。 Chrome和Firefox 没问题。那我上面说得废话。

  • 回复于 2012-07-11 09:35 举报

    感谢各位。问题已经找到。TMD,网管给php.ini 里面 设置的cookie_path 不对。IE和 FIREFOX等处理方式不同。

您需要登录后才可以回复。登录 | 立即注册