This function can place all of the session variables that are of course registered as NULL. Note that it is not unregister, but also different from destroy.
The following example shows a good description of this function.
Set some parameter parameters for the session cookie, similar to the setting in PHP.ini, but the settings made by this function are valid only for the current script file.
//*******************************
The following function should be useful for everyone, are you interested in customizing a session that is not saved with cookies? This function will achieve your vision.
Let me think, what's the advantage of not using cookies? At least one point, you don't have to worry about whether the client's cookie function is turned on, right.
This function can define the Save function (open, close, write, and so on) of the user-level session.
This function is useful, for example, when we want to save a session in a local database.
!! Note: Before using this function, you must first configure the php.ini file, Session.save_hadler=user, otherwise, Session_set_save_handler () will not take effect.
Also, according to my tests, if you want this session to be used across pages, add your own functions and Session_set_save_handler to every script file that you use in the session, so the best way is to make a separate file, Include in every script that will use session.
The following example provides a basic session save method, similar to the default files method.
If you want to use the database to achieve, this is also very easy to do.
Example 1. Session_set_save_handler () example
<?php
function open ($save _path, $session _name) {
Global $sess _save_path, $sess _session_name;
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.