How to update login times and time
Fan sear
Fan sear 2018-03-30 17:03:52
0
6
1594

How to design the database to update these two

搜狗截图18年03月30日1652_1.png搜狗截图18年03月30日1656_3.png

Fan sear
Fan sear

reply all(2)
异蛇科技

I'm wrong. This variable has a key that stores user information. The key is not the user variable but the session

  • reply Is 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.
    Fan sear author 2018-03-30 19:49:17
  • reply Wrong, it's login_count
    Fan sear author 2018-03-30 19:52:56
  • reply Yes, just add 1 to the count stored in the database before exiting (clearing the session)
    铭德科技 author 2018-03-31 09:18:28
  • reply public 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 }
    铭德科技 author 2018-03-31 09:26:58
异蛇科技

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

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template