_unserialize 命令/方法/函数

Description

A utility method to unserialize data with whatever serializer is set up. If there is no serializer set, the value will be returned unchanged. If there is a serializer set up, and the data passed in is malformed, an exception will be thrown. This can be useful if phpredis is serializing values, and you return something from redis in a LUA script that is serialized.

反序列化函数,用于序列化的SET类型数据。如果参数不是序列化的SET,那么会直接返回。如果是一个序列化的SET,但不是PHP-REDIS序列化的格式,函数将抛出一个异常。


Parameters

value string. The value to be unserialized


Examples

$redis->setOpt(Redis::OPT_SERIALIZER, Redis::SERIALIZER_PHP);

$redis->_unserialize('a:3:{i:0;i:1;i:1;i:2;i:2;i:3;}'); // Will return Array(1,2,3)