1, Note:
When logging in with a user password, store the password in the session. You need to set the secret key in the config.php file;
Then in the autoload.php file Set the session to load automatically;
2, use method
After the login password and username are verified correctly, save the password and username into the session for a more secure location
$sessionData = array( 'username' => $username, 'password' => $password, 'time' => time() ); $this->session->set_userdata($sessionData);
3, take out session
$this->session->userdata("xxxxxxxxx"); (userdata中放取出的字段)
4, config.php sets the path of session storage
##
$config['sess_save_path'] =BASEPATH.'../'.'session_file';session folder If it exists in the root directory, the session_file folder will be automatically created
A PHP Error was encountered Severity: Warning Message: mkdir(): Invalid path Filename: drivers/Session_files_driver.php Line Number: 117 Backtrace: File: /Library/WebServer/Documents/CI/cinews/ci/index.php Line: 316 Function: require_onceThe above is the encryption used when logging in in the CI framework session and session issues to note. For more related content, please pay attention to the PHP Chinese website (www.php.cn)!