Home  >  Article  >  Backend Development  >  Data anomaly - I encountered a strange problem in the thinkphp project. The data will be changed after inserting records.

Data anomaly - I encountered a strange problem in the thinkphp project. The data will be changed after inserting records.

WBOY
WBOYOriginal
2016-11-30 23:59:561168browse

thinkphp data exception phpbug

Data anomaly - I encountered a strange problem in the thinkphp project. The data will be changed after inserting records.As shown in the figure, when the first two print_r have exit statements at the back, the data printed by print_r is normal. However, if you put exit after the sentence of inserting records (the sentence in the red box), some of the things printed will become null.
Obviously, the above $_GET and data were modified when executing the insert statement. But the printing is before the insert statement.
The picture below is the print_r print after the exit statement is placed after the insert statement;
Data anomaly - I encountered a strange problem in the thinkphp project. The data will be changed after inserting records.
The following is the print_r print after the exit statement is placed before the insert record
Data anomaly - I encountered a strange problem in the thinkphp project. The data will be changed after inserting records.

This problem has troubled me for a long time, and I never know how to solve it. I hope someone who understands or has encountered the same problem can give me answers or discuss it together.

Reply content:

Isn’t exit already ending the current script? What you defined should not take effect. How can you add it?

If you use the D("") method, check if the corresponding model has rewritten the add() method and added some field filtering or permission checking, or try changing D() to M(). Try

Statement:
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