Differences between session_unset and session_destroy

Source: Internet
Author: User
This article describes the differences between session_unset and session_destroy in php. For more information, see Session_unset ()
Releases all the $ _ SESSION variables that have been created in the memory, but does not delete the session file or release the corresponding sessionid.
Session_destroy ()
Delete the session file corresponding to the current user and release the sessionid. The $ _ SESSION variable in the memory is retained.
Therefore, to release all resources of a user's session, execute the following code in sequence:
Program code
The code is as follows:
$ _ SESSION ['user'] = 'hangzhou ';
Session_unset ();
Session_destroy ();
?>

If you only call session_destroy ();
The echo $ _ SESSION ['user'] still has a value.
That is, the $ _ SESSION variable content in the memory is retained.
[Session]
Session. save_handler = files; control method for saving/retrieving data
Session. save_path = C: \ win \ temp; parameters passed to the controller when save_handler is set to a file,
; This is the path where the data file will be saved. Folder must be created in advance
Session. use_cookies = 1; whether to use cookies 1 Yes, 0 no
Session. name = PHPSESSID
The name of the session used in the cookie.
Session. auto_start = 0; initialize the session when the request starts.
Session. cookie_lifetime = 0; the time when the cookie is saved in seconds,
; Or 0 until the browser is restarted
Session. cookie_path =/; valid cookie path
Session. cookie_domain =; valid domain of the cookie
Session. serialize_handler = php; controller used to connect data
Php is the standard controller of PHP.
Session. gc_probability = 1; percentage of 'garbage collection (fragment) 'processes
; The possibility of starting each session initialization.
Session. gc_maxlifetime = 1440; after the number of seconds, the stored data will be treated
; 'Garbage 'and cleared by the gc process.
Session. referer_check =; check the HTTP reference to invalidate the ids contained in the URL.
Session. entropy_length = 0; the number of bytes read from the file
Session. entropy_file =; specify the session id created here
; Session. entropy_length = 16
; Session. entropy_file =/dev/urandom
Session. cache_limiter = nocache; set to {nocache, private, public} to determine the HTTP
; Cache problems
Session. cache_expire = 180; Document expired after n minutes
Session. use_trans_sid = 1; use the transitional sid support.
; -- Enable-trans-sid
Url_rewriter.tags = "a = href, area = href, frame = src, input = src, form = fakeentry"
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.