1, method when session passes object.
Under normal circumstances, the session only needs to save some basic types of data, such as strings.
But if it is a custom class, you need to use serialization and deserialization
<code>1.1,$UserData = new ......;//创建对象 1.2, $_SESSION['UserData'] = serialize($UserData );//序列化类传递 1.3,$UserData = unserialize($_SESSION["UserData"]);//反序列化类接受 </code>
Copyright statement: This article is an original article by the blogger and may not be reproduced without the blogger's permission.
The above introduces the notes on PHP, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.