原型
json_decode( string $string, bool $assoc_array = false )
参数
$string
(string)
(Required)
$assoc_array
(bool)
(Optional)
返回值
(object|array)
源文件
路径:wp-includes/compat.php
<?php
...
function json_decode( $string, $assoc_array = false ) {
global $wp_json;
if ( ! ($wp_json instanceof Services_JSON ) ) {
require_once( ABSPATH . WPINC . '/class-json.php' );
$wp_json = new Services_JSON();
}
$res = $wp_json->decode( $string );
if ( $assoc_array )
$res = _json_decode_object_helper( $res );
return $res;
}
...
?>
其他
英文文档:https://developer.wordpress.org/reference/functions/json_decode/