Home >PHP Framework >ThinkPHP >Why does the TP form hide the hash value?

Why does the TP form hide the hash value?

藏色散人
藏色散人forward
2021-12-06 15:46:401809browse

The following thinkphp framework tutorial column will introduce to you why the TP form hides the hash value. I hope it will be helpful to friends in need!

Why does the TP form hide the hash value?

Some forms in ThinkPHP will add a hidden hash value. According to the manual, it is to prevent repeated submission of the form and other security protections. What is the security protection here? ?

What is the reason why ThinkPHP forms hide hash values?

Then read the answer~

This is to prevent repeated submissions, because sometimes, we can only allow users to submit once

The specific principle is as follows:

First of all, this hash value is generated by the server, and then saved in the session. When the user submits, first determine whether it exists in the session. If it exists, clear the hash value. When submitting next time, because the hash value has been If it is invalid, the submission will fail.

Recommended: "The latest 10 thinkphp video tutorials"

The above is the detailed content of Why does the TP form hide the hash value?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:segmentfault.com. If there is any infringement, please contact admin@php.cn delete