check_ajax_referer

動作鉤子
do_action( 'check_ajax_referer', $action, $result )
引數
  • (string) $action The Ajax nonce action.
    Required:
  • (false|int) $result False if the nonce is invalid, 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.
    Required:
定義位置
相關勾子
check_admin_referercheck_is_user_spammedcheck_passwordheartbeat_received
相關方法
check_ajax_referercheck_admin_referercheck_password_reset_keywp_get_raw_refererwp_get_refererwp_ajax_parse_embed
引入
2.1.0
棄用
-

check_ajax_referer – 這是WordPress中的一個函式,用於檢查AJAX請求中的nonce值,以確保它是由一個經過認證的使用者傳送的,並且請求是有效的: 這個函式是用來防止AJAX請求中的跨站請求偽造(CSRF)攻擊。

一旦Ajax請求被驗證或沒有被驗證,就會發生觸發。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
do_action( 'check_ajax_referer', $action, $result );
do_action( 'check_ajax_referer', $action, $result );
do_action( 'check_ajax_referer', $action, $result );

常見問題

FAQs
檢視更多 >