Home  >  Article  >  Backend Development  >  Notes on php

Notes on php

WBOY
WBOYOriginal
2016-08-08 09:20:07774browse

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.

Statement:
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