bobysky

bobysky

这家伙有点懒,还没写个性签名!

  • 财富值0
  • 威望值0
  • 总积分230

个人信息

  • 提出了问题
    域名地址区分商城多店铺实现,求助
  • 回复了 的回答

    没怎么理解,是不是这样:

    $model = TableName::findAll(['productID' => 2]);
    $model->status = 2;
    $model->save();
    

    这样不行 ,$model->status = 2; 这一行会提示 : Attempt to assign property of non-object -

  • 提出了问题
    更新多天数据
  • 提出了问题
    通过域名,区分多店铺的问题
  • 提出了问题
    Yii2 的 find 查询条件问题
  • 为什么我登录成功后,Yii::$app->user->isGuest值还是true?

  • 回复了 的回答
    //isGuest从这获取
    public function getIsGuest()
    {
        return $this->getIdentity() === null;
    }
    
    //这个方法调用的$this->_identity,即是你上面那个方法设定的
    //你上面那个方法也是传得一个参数进去的,它是一个实例于IdentityInterface接口的对像,具体实现自已写
    //它里面有各种获取_identity的方法,比如findIdentity(),,,
    public function getIdentity($autoRenew = true)
    {
        if ($this->_identity === false) {
            if ($this->enableSession && $autoRenew) {
                $this->renewAuthStatus();
            } else {
                return null;
            }
        }
    
        return $this->_identity;
    }
    

    public function actionLogin()
    {
        if (!\Yii::$app->user->isGuest) {
            return $this->goHome();
        }
        $model = new LoginForm();
        if ($model->load(Yii::$app->request->post()) && $model->login()) {
    
          /*在这里我var_dump(Yii::$app->user->isGuest );  值为false, 执行下面一句$this->goBack() ,跳到主页后,var_dump(Yii::$app->user->isGuest ); 值变为true,表示未认证用户,  在这个问题纠结很久了, 也没思路去排错 ,,请指教下.*/
    
            return $this->goBack();
        } else {
            return $this->renderPartial ('login', [
                'model' => $model,
            ]);
        }
    }
    
  • 回复了 的回答
    //isGuest从这获取
    public function getIsGuest()
    {
        return $this->getIdentity() === null;
    }
    
    //这个方法调用的$this->_identity,即是你上面那个方法设定的
    //你上面那个方法也是传得一个参数进去的,它是一个实例于IdentityInterface接口的对像,具体实现自已写
    //它里面有各种获取_identity的方法,比如findIdentity(),,,
    public function getIdentity($autoRenew = true)
    {
        if ($this->_identity === false) {
            if ($this->enableSession && $autoRenew) {
                $this->renewAuthStatus();
            } else {
                return null;
            }
        }
    
        return $this->_identity;
    }
    

    为什么我登录成功后,页面一跳转$this->_identity 值变为null , 这样Yii::$app->user->isGuest 值又变成true了

  • 提出了问题
    Yii2.0 的用户登录问题
  • 提出了问题
    ActiveForm 中 fieldConfig 的配置问题
见习主管 等级规则
230/500
资料完整度
20/100
用户活跃度
0/100

Ta的关注

0

Ta的粉丝

6

Ta的访客

16