CakePHP CSRF验证
super
2022-09-10 21:49
1449
https://book.cakephp.org/4/en/security/csrf.html#csrf-protection
$token = $this->request->getAttribute('csrfToken');
$this->set('X-CSRF-Token', $token);
AJAX:
beforeSend: function (xhr) {
xhr.setRequestHeader('X-CSRF-Token', $('[name="_csrfToken"]').val());
},
0 条讨论