1. In the middle of Yi’s loginForm, there is a login method to set the time to remember the user name:
public function login() bracket if($this->_identity===null) bracket $this->_identity=new UserIdentity($this->username,$this->password); $this->_identity->authenticate(); bracket if($this->_identity->errorCode===UserIdentity::ERROR_NONE) bracket $duration=$this->rememberMe ? 3600*24*10 : 0; // 10 days Yii::app()->user->login($this->_identity,$duration); return true; bracket Else return false; bracket bracket
As above, if I put $duration=$this->rememberMe? 36002410 : 0; // 10 days, that is, I set it to 10 days. Is the validity period of cookie set to 10 days, or is the validity period of cookie and session set to 10 days?
I want to set the validity period of the session to 10 days. I don’t know where to set it.
Another problem is that if the cookie is 10 days, the session is only half an hour. When I logged in with the cookie the next day, did PHP generate a session based on the cookie?
Or does php automatically generate a session and then rewrite the sessionID back into the cookie?
Session exists on the server.
Cookie exist on the client, that is, your own computer.
If your browser is turned off, the session will fail.
The validity period of the session is controlled by the server settings.