wpseek.com
WordPress开发者和主题制作者的搜索引擎
rest_sanitize_object › WordPress Function
Since5.5.0
已弃用n/a
› rest_sanitize_object ( $maybe_object )
参数: |
|
返回: |
|
定义在: |
|
文档: |
Converts an object-like value to an array.
Related Functions: rest_sanitize_boolean, rest_is_object, sanitize_user_object, rest_sanitize_array, rest_sanitize_request_arg
源码
function rest_sanitize_object( $maybe_object ) { if ( '' === $maybe_object ) { return array(); } if ( $maybe_object instanceof stdClass ) { return (array) $maybe_object; } if ( $maybe_object instanceof JsonSerializable ) { $maybe_object = $maybe_object->jsonSerialize(); } if ( ! is_array( $maybe_object ) ) { return array(); } return $maybe_object; }