Session_Start或PHP请求不起作用

Wit the code below I'm always automatically logged out from my system.. If I remove all classes includes session works very well..

I'm not sure where the problem is ..... session_start or bad PHP requests ?? Any suggestion? Thanks!

Update: Ah... I just remove updateUserSession from my code and works fine now

  1. Be sure that $_SESSION['user_name'] and $_SESSION['user_id'] contain valid values.
  2. I think this part of code is wrong: if($_SESSION['user_id']==1) and must be if(!empty($_SESSION['user_id']))

About the second point, your current code is verifying that user_id is 1, instead with my replacement PHP verifies that $_SESSION['user_id'] is NOT empty.