replyIs it possible to update the value of login_time in the database in the method of logging out? The next time you log in, you will get the updated number.
replypublic function exitFun(){
//Find the session data that stores the user based on the user_id of the user session. The yyy method is to obtain the data.
$res = model('xxx')->yyy($user_id);
//The number of times obtained plus the number of logins equals the new number of times
$count = $res['count'] +1
//Execute to update the new number $count to the corresponding user's login times
$newRes = model('xxx')->zzz($user_id,$count);
//Clear SESSION after completion and launch login
//This is only in the controller, the data layer should be fine
}
Judging from {$Think.session.user_info.login_count}, a template variable $Think should be passed from the controller. This variable is the session that stores user information. So there should be a field in the table to store the session, and the session is updated every time you log in
I'm wrong. This variable has a key that stores user information. The key is not the user variable but the session
Judging from {$Think.session.user_info.login_count}, a template variable $Think should be passed from the controller. This variable is the session that stores user information. So there should be a field in the table to store the session, and the session is updated every time you log in