What is this? why can't I add only one piece of information to the database using thinkphp?

Source: Internet
Author: User
What is the error? why can't I add only one message to the database using thinkphp PHPcodepublicfunctioninsert () {$ guest = M (& quot; Author & quot? what is the error, why can't I add only one piece of information to the database using thinkphp?
PHP code
  Public function insert () {$ guest = M ("Author"); $ guest-> create (); $ guest-> add ();}



Only the first time can be added.

------ Solution --------------------
Data cache files. Because the Create () function will automatically Create some php files that store fields and perform type verification. During the 2nd Create () operation, if the file exists, it will not be searched in the database and will be used directly.
Therefore, after you modify the table structure, you must delete the cache file ......

The general location is in the project folder: \ KONAKONA_App \ Runtime \ Data \ _ fields \. it does not matter if all files under this folder are deleted, and will be automatically re-created.

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.