Notes on php

WBOY
Release: 2016-08-08 09:20:07
Original
858 people have browsed it

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>
Copy after login

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.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template