大网数据广告活动
PHP 语言与运行手册

igbinary_unserialize · Creates a PHP value from a stored representation from igbinary_serialize

· 52CE 我爱测

igbinary_unserialize — Creates a PHP value from a stored representation from igbinary_serialize()

igbinary_unserialize

(PECL igbinary >= 1.1.1)

igbinary_unserialize — Creates a PHP value from a stored representation from igbinary_serialize()

说明

function igbinary_unserialize(string $str): mixed

igbinary_unserialize() takes a single serialized variable from igbinary_serialize() and converts it back into a PHP value.

警告

Untrusted user input must not be passed to igbinary_unserialize(). Unserialization can result in code being loaded and executed due to object instantiation and autoloading, and a malicious user may be able to exploit this. Instead a safe, standard data interchange format such as JSON (via json_decode() and json_encode()) should be used, if serialized data needs to be passed to a client.

If there is the need to unserialize externally-stored serialized data, hash_hmac() can be used for data validation. It is important to ensure that nobody has tampered with the data.

警告

The igbinary serialization format does not provide a way to distinguish between different reference groups for the same value. All PHP references to a given value as treated as part of the same reference group when unserialized, even if they were parts of difference reference groups when serialized.

参数

str

The serialized string generated by igbinary_serialize().

If the value being unserialized is an object, after successfully reconstructing the object igbinary will automatically attempt to call the __unserialize() or __wakeup() methods (if one exists).

注意: unserialize_callback_func directive

The callback specified in the unserialize_callback_func directive is called when an undefined class is unserialized. If no callback is specified, the object will be instantiated as __PHP_Incomplete_Class.

返回值

The converted value is returned, and can be a bool, int, float, string, array, object, or null.

In case the passed string is not unserializeable, false is returned and E_NOTICE or E_WARNING is issued.

错误/异常

Objects may throw Throwables in their unserialization handlers.

注释

警告

null or false is returned both in the case of an error and if unserializing the serialized null or false value. It is possible to catch this special case by comparing str with igbinary_serialize(null) or igbinary_serialize(false) or by catching the issued E_NOTICE.

参见

来源:PHP Documentation Group · 作者与贡献记录 · CC BY 3.0。离线整理了版式、链接和媒体显示。

资料来源与适用范围

资料来源
PHP Documentation Group
适用范围
请按文中版本与环境说明核对
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。