1
我在我的项目中为用户提供了一个特例。如果用户的订阅已过期(我在login action
中查看),他将被重定向到他的profile
以编辑一些选择。我如何防止他访问除他的profile
之外的任何页面。这是我在login action
如何只访问一个特定页面YII2(高级模板)?
if($subPaymentType == 'free'){
$subHours = $data[0]['sub_hours'];
$minutes = $subHours * 60 * 60;
$start_time = date('d-m-Y H:i:s', $startDate);
$endDate = $minutes + strtotime($start_time);
$endDate = date('d-m-Y H:i:s', $endDate);
if(strtotime(date('d-m-Y:')) < strtotime($endDate)){
$model->login();
}else{
$model->login();
//User can access this only page only
return $this->redirect(['user/view/?id='.Yii::$app->user->id]);
}
}