php yii framework post csrf

WBOY
Release: 2016-07-29 08:51:16
Original
1001 people have browsed it

Friends in the Tieba group encountered this problem today.

When he submitted using ajax post, it would throw 400 php yii框架 post csrf

Then he found a solution on the yii forum php yii框架 post csrf

But the _csrf passed was undefined . Seeing this, I knew what was going on. The corresponding object was not found for this jq.

<?php echo Yii::app()->getRequest()->getCsrfToken(); ?>
Copy after login
directly assigns it to the value of this csrf token. Finally, a verification prompt appeared.

php yii框架 post csrf

Verification error. Eighty percent of the time it is not this parameter name. See if this thing is saved in the cookie session.

I did find this ghost in cookie.

php yii框架 post csrf

I haven’t played this thing much either. Try changing the parameter name to YII_CESRF_TOKEN.

Then click submit and it’s over.

csrf is a built-in tool in Yii to prevent cross-domain attacks. The main principle is to give an encrypted value. First verify that the value exists. is it right or not. Then process the form and other operations.

The above introduces the php yii framework post csrf, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template