*/publicfunctionpost_save($post_id){if(array_key_exists($this->getPlugin()->getSlug(), $_POST)) {if(!wp_verify_nonce($_POST[$this->getPlugin()->getSlug()],$this->getPlugin()->getSlug())) {return$post_id; }if(defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {return$post_id;...
wp_verify_nonce ( $nonce, $action = -1 ) Parameters: (string) nonce Nonce value that was used for verification, usually via a form field. (string|int) action Should give context to what is taking place and be the same when nonce was created.Returns: (int|false) 1 if the nonce is...
1. 使用 wp_create_nonce 生成一个 nonce 2. 将生成的 nonce 交给链接或表单 3. 收到请求后,先验证 nonce 代码如下: <?php$nonce=wp_create_nonce('zhuige');if(isset($_POST['submit']) && !wp_verify_nonce($_POST['nonce'],'zhuige')) {wp_die('非法提交'); }?><inputtype="hidden"name...
php wp_verify_nonce($nonce, $action); ?> 参数 $nonce(字符串)(必需)用来验证的随机数,默认值:None $action(字符串)(整数)解释当前操作,生成随机数后也应进行同样解释。默认值:-1,返回的值无论随机数是否通过验证,都返回布尔变量。