╃巡洋艦㊣
- ╃巡洋艦㊣ 回答了问题 怎么验证用户是否已经登陆
如果只是简单的判断用户是否登录,可以使用如下方法:
if(Yii::$app->user->isGuest) { //未登录状态 } else { //已登录状态 }
- ╃巡洋艦㊣ 回答了问题 怎么验证用户是否已经登陆
控制器中可以使用
AccessControl
来控制是否需要登录才能访问。public function behaviors() { return [ 'access' => [ 'class' => AccessControl::className(), 'only' => ['other1', 'other2'], 'rules' => [ [ 'actions' => ['other1', 'other2'], 'allow' => true, 'roles' => ['@'], ], ], ], ]; }
- ╃巡洋艦㊣ 2016-06-25 已签到连续签到469天,获得了20个金钱
- ╃巡洋艦㊣ 赞了说说今天又到星期五~\(≧▽≦)/~啦啦啦
- ╃巡洋艦㊣ 2016-06-24 已签到连续签到468天,获得了20个金钱
- ╃巡洋艦㊣ 2016-06-23 已签到连续签到467天,获得了20个金钱
- ╃巡洋艦㊣ 2016-06-22 已签到连续签到466天,获得了20个金钱
- ╃巡洋艦㊣ 2016-06-21 已签到连续签到465天,获得了20个金钱