rest_stabilize_value
函数
rest_stabilize_value ( $value )
- 参数
-
-
(mixed)
$value
The value to stabilize. Must already be sanitized. Objects should have been converted to arrays.- Required: 是
-
(mixed)
- 返回值
-
- (mixed) The stabilized value.
- 定义位置
-
-
wp-includes/rest-api.php
, line 1691
-
wp-includes/rest-api.php
- 引入
- 5.5.0
- 弃用
- –
Stabilizes a value following JSON Schema semantics.
For lists, order is preserved. For objects, properties are reordered alphabetically.
function rest_stabilize_value( $value ) { if ( is_scalar( $value ) || is_null( $value ) ) { return $value; } if ( is_object( $value ) ) { _doing_it_wrong( __FUNCTION__, __( 'Cannot stabilize objects. Convert the object to an array first.' ), '5.5.0' ); return $value; } ksort( $value ); foreach ( $value as $k => $v ) { $value[ $k ] = rest_stabilize_value( $v ); } return $value; }
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。