At this point, the function bool Session_set_save_handler (callback open, callback close, callback read, callback write, callback destroy, CALLB ACK GC) is the solution provided to us to solve this problem.
The function uses the following 6 functions:
1. bool Open () for opening session storage mechanism,
2. BOOL Close () closes the session store operation.
3. Mixde read () Use this function when the session data is mounted from storage
4. BOOL Write () writes all data for a given session ID to the store
5. bool Destroy () destroys data associated with the specified session ID
6. BOOL GC () garbage collection of data in the storage system
For example, see the PHP manual Session_set_save_handler () function.
If you are working with a class, you can use
Copy Code code as follows:
Session_set_save_handler (
Array (' ClassName ', ' open '),
Array (' ClassName ', ' close '),
Array (' ClassName ', ' read '),
Array (' ClassName ', ' write '),
Array (' ClassName ', ' destroy '),
Array (' ClassName ', ' GC '),
)
Call 6 static methods in the ClassName class. ClassName can swap objects without invoking static methods, but with static members without generating objects, performance is better.