thinkphp Form token error related resolution analysis, thinkphp token
This paper analyzes the related solutions to the Thinkphp form token error. Share to everyone for your reference, as follows:
Today in the use of thinkphp to do the program, used to create the data before, there was an error "form token error", and then a variety of Baidu Google, the online solution to get the following suggestions
1, clear cache: With, I put all the cache files are deleted, and ~app.php and ~runtime.php two files are deleted, but no effect.
2, set the token_on parameter to false: tried, but also not, although the form token is not prompted wrong, but the data added to the database is empty.
3. Add {__notoken__} to the form of the template file: added, but the result is also invalid!
When I get here, I don't have any words, is it thinkphp on my computer? I think it is not, I re-write a add function, the result is normal, this time I began to think, is not my last function is wrong? But after the check, it's true! Later slowly a file began that view Ah, finally let me find the reason:
In the thinkphp auto-generated folders, there is a folder called "Data", there is a "_fields" folder, which is stored in the data tables in each model of the relevant information, but also as a map (I understand), I carefully examined one, found that There are two files in which only "' _autoinc ' is true," this one, the others are many, similar to:
<?phpreturn Array (0 = ' id ', 1 = ' title ', 2 = ' content ', 3 = ' Publishedtime ', 4 = ' UserID ', 5 => ; ' Params ', ' _autoinc ' = ' = ', ' _pk ' = ' id ', '; >
By this time can know the reason, is an operation to delete this data part, so that thinkphp in the form validation, the data can not be mapped, it will lead to thinkphp errors, they will be added in the order of the data table after the re-run, normal!
To this, the problem solved ~ ~ ~
(The thinkphp environment described in this article is an earlier version, the user can refer to the corresponding directory when using the new version)
PS: Here are recommended several of the site's formatting/beautification/conversion tools can help you tidy up the messy code, I believe that you can use in future development:
PHP Code online format Beautification tool:
Http://tools.jb51.net/code/phpformat
JavaScript code beautification/compression/formatting/encryption Tools:
Http://tools.jb51.net/code/jscompress
Online XML format/compression tool:
Http://tools.jb51.net/code/xmlformat
JSON Code formatting beautification tool:
Http://tools.jb51.net/code/json
Online Xml/json Mutual Conversion tool:
Http://tools.jb51.net/code/xmljson
JSON code online formatting/landscaping/compression/editing/conversion tools:
Http://tools.jb51.net/code/jsoncodeformat
SQL code online Format beautification tool:
Http://tools.jb51.net/code/sqlcodeformat
More interested in thinkphp related content readers can view this site topic: "thinkphp Introductory Tutorial", "thinkphp Common Method Summary", "PHP Cookie Usage Summary", "Smarty Template Primer Basic Tutorial" and "PHP template technology Summary."
It is hoped that this article is helpful to the PHP program design based on thinkphp framework.
http://www.bkjia.com/PHPjc/1133130.html www.bkjia.com true http://www.bkjia.com/PHPjc/1133130.html techarticle thinkphp Form token error related resolution analysis, thinkphp token this article analyzes the related solutions to thinkphp form token errors. Share to everyone for your reference, as follows: ...