rest_sanitize_request_arg() - WordPress 函数参考中文文档

返回介绍

rest_sanitize_request_arg()

发布于 2017-09-11 字数 1536 浏览 956 评论 0

rest_sanitize_request_arg( mixed $value,  WP_REST_Request $request,  string $param )

Sanitize a request argument based on details registered to the route.


描述


参数

$value

(mixed)
(Required)

$request

(WP_REST_Request)
(Required)

$param

(string)
(Required)


返回值

(mixed)


源代码

File: wp-includes/rest-api.php

function rest_sanitize_request_arg( $value, $request, $param ) {
	$attributes = $request->get_attributes();
	if ( ! isset( $attributes['args'][ $param ] ) || ! is_array( $attributes['args'][ $param ] ) ) {
		return $value;
	}
	$args = $attributes['args'][ $param ];

	return rest_sanitize_value_from_schema( $value, $args );
}

更新日志

Version 描述
4.7.0 Introduced.

相关函数

Uses

  • wp-includes/rest-api.php:
    rest_sanitize_value_from_schema()

Used By

  • wp-includes/rest-api.php:
    rest_parse_request_arg()

User Contributed Notes

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

目前还没有任何评论,快来抢沙发吧!