首页 WordPress函数大全 check_ajax_referer()

check_ajax_referer()

2020-05-01 / 5316阅 / 悠然

如何你看完本文还不知道如何使用该函数,可以联系我定制视频教程,50元/个函数,学不会全额退款

check_ajax_referer( int|string $action = -1, false|string $query_arg = false, bool $die = true )

Verifies the Ajax request to prevent processing requests external of the blog.

描述

参数

$action

(int|string)
(Optional)
Action nonce.

Default value: -1

$query_arg

(false|string)
(Optional)
Key to check for the nonce in $_REQUEST (since 2.5). If false, $_REQUEST values will be evaluated for '_ajax_nonce', and '_wpnonce' (in that order).

Default value: false

$die

(bool)
(Optional)
Whether to die early when the nonce cannot be verified.

Default value: true

返回

(int|false) 1 if the nonce is valid and generated between 0-12 hours ago, 2 if the nonce is valid and generated between 12-24 hours ago. False if the nonce is invalid.

大家谈论
    我的见解