ThinkPHP form token error solution analysis, thinkphp token _ PHP Tutorial

Source: Internet
Author: User
ThinkPHP form token error solution analysis, thinkphp token. ThinkPHP form token error solution analysis, thinkphp token This article analyzes the ThinkPHP form token error solution. For your reference, refer to the ThinkPHP form token error solution and thinkphp token.

This article analyzes the solutions to ThinkPHP form token errors. We will share this with you for your reference. The details are as follows:

Today, when ThinkPHP is used as a program, when we used to create data using create, an error message "form token error" was prompted, and then various types of Baidu Google, the following suggestions are provided on the Internet.

1. clear Cache: yes. I deleted all the files under the Cache and deleted ~ App. php and ~ The runtime. php files are deleted at the same time, but the results are ineffective.

2. set the TOKEN_ON parameter to FALSE. if you have tried it, the TOKEN_ON parameter is not displayed. although the form token is incorrect, the data added to the database is empty.

3. Add {__notoken __} to the form in the template file, but the result is also invalid!

Now I am speechless. isn't ThinkPHP on my computer good? I think it should not be. I wrote another Add function and the result was normal. at this time, I began to think, was my previous function wrong? But after the check, we found that it was correct! Later, I started viewing files one by one, and finally found the cause:

In various folders automatically generated by ThinkPHP, there is a folder named "Data", which contains the "_ fields" folder, this folder stores the relevant information in the data tables of each model, even if it is ing (I understand). I carefully checked one and found that, there are only one of the following files: '_ autoinc' => true, "and many others, similar:

<?phpreturn array ( 0 => 'id', 1 => 'title', 2 => 'content', 3 => 'publishedtime', 4 => 'userid', 5 => 'params', '_autoinc' => true, '_pk' => 'id',);?>

At this time, we can know the reason. it is because an operation deletes some of the data, so ThinkPHP cannot map the data during form verification, this leads to ThinkPHP errors. after they are added in the order in the data table, they can run again!

At this point, this problem can be solved ~~~~

(The thinkPHP environment described in this article is an earlier version. when using the new version, you can refer to the corresponding directory)

PS: We recommend several formatting, beautification, and conversion tools on this site to help you sort out messy code. I believe you can use them in future development:

Php code online formatting and beautification tools:
Http://tools.jb51.net/code/phpformat

JavaScript code beautification/compression/Formatting/encryption tools:
Http://tools.jb51.net/code/jscompress

Online XML formatting/compression tools:
Http://tools.jb51.net/code/xmlformat

JSON code formatting and beautification tools:
Http://tools.jb51.net/code/json

Online XML/JSON conversion tools:
Http://tools.jb51.net/code/xmljson

Json code online Formatting/beautification/compression/editing/conversion tools:
Http://tools.jb51.net/code/jsoncodeformat

SQL code online formatting and beautification tools:
Http://tools.jb51.net/code/sqlcodeformat

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.