maybe_unserialize

函数


maybe_unserialize ( $data )
参数
  • (string)
    $data
    Data that might be unserialized.
    Required:
返回值
  • (mixed) Unserialized data can be any type.
定义位置
  • wp-includes/functions.php
    , line 649
引入
2.0.0
弃用

Unserializes data only if it was serialized.

function maybe_unserialize( $data ) {
	if ( is_serialized( $data ) ) { // Don't attempt to unserialize data that wasn't serialized going in.
		return @unserialize( trim( $data ) );
	}

	return $data;
}