In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains "how to solve the problem of thinkphp save failure". The content of the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to solve the problem of thinkphp save failure".
The solution to thinkphp save failure: 1, open the corresponding code file; 2, use "$this- > typeModel- > field ('id,name,sort')-> data ($data)-> save ();" to update the data.
This article operating environment: Windows7 system, thinkphp v5.1, Dell G3 computer.
How to solve the problem of thinkphp save failure?
Failed to update thinkphp save ()
I. failure cases
$data = I (); $rs = $this- > typeModel- > data ($data)-> save ()
II. Correct cases
Correct one: rs=$this- > typeModel- > field ('id,name,sort')-> data ($data)-> save (); correct 2: / / $rs=$this- > typeModel- > where (' id='.$data ['id'])-> field (' name,sort')-> data ($data)-> save (); correct 3: / / $rs=M ('CityCategory')-> where (' id='.$data ['id'])-> field (' name,sort')-> data ($data)-> save (); / Note: / / 1. If the new data is the same as the original data, it will be the same as the new failure / / 2. No field restriction will result in modification failure / / 3. You need to write the primary key id and the field to be changed in field, or write the primary key id in the where condition.
Third, cause analysis
All the fields id pid name path sort in the value $data received from the foreground have values, but some of the new data is the same as the old data.
When the new data and the old data have the same field data, you need to use field to determine the data that needs to be changed. It is estimated that it will be updated even if it is the same in field.
Thank you for your reading, the above is the content of "how to solve the problem of thinkphp save failure", after the study of this article, I believe you have a deeper understanding of how to solve the problem of thinkphp save failure, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.