maybe_unserialize()
maybe_unserialize( string $original )
仅当值已序列化时才取消序列化。
Unserialize value only if it was serialized.
参数(Parameters)
参数 | 类型 | 必填 | 说明 |
---|---|---|---|
$original | (string) | 必需 | 如果需要的话,可能是未经序列化的原稿。 |
返回(Return)
(mixed)未序列化的数据可以是任何类型。
源码(Source)
/** * Unserialize value only if it was serialized. * * @since 2.0.0 * * @param string $original Maybe unserialized original, if is needed. * @return mixed Unserialized data can be any type. */ function maybe_unserialize( $original ) { if ( is_serialized( $original ) ) // don't attempt to unserialize data that wasn't serialized going in return @unserialize( $original ); return $original; }
更新版本 | 源码位置 | 使用 | 被使用 |
---|---|---|---|
2.0.0 | wp-includes/functions.php:592 | 10 | 1 function |
maybe_unserialize() 为WP2原创文章,链接:https://www.wp2.cn/functions/maybe_unserialize/