In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces the relevant knowledge of add method case analysis in thinkphp, the content is detailed and easy to understand, the operation is simple and fast, and it has a certain reference value. I believe you will have something to gain after reading this thinkphp add method case analysis article. Let's take a look.
The return value of the add () method in thinkphp: 1, "ID of inserting data", when the ID of inserting data is returned, it means that the method inserted data successfully; 2, "false", when false is returned, it indicates that the method has failed to insert data.
This article operating environment: Windows10 system, ThinkPHP5 version, Dell G3 computer.
What is the return value of the add method in thinkphp
ThinkPHP's built-in add method is used to add data to the data table, which is equivalent to the INSERT INTO behavior in SQL.
Examples of use are as follows:
$User = M ("User"); / / instantiate the User object $data ['name'] =' ThinkPHP';$data ['email'] =' ThinkPHP@gmail.com';$User- > add ($data)
Or use the data method to operate coherently
$User- > data ($data)-> add ()
If the data object has been created before add (for example, using the create or data method), the add method does not need to pass in any more data.
When the add () method succeeds, it returns the id that inserted the data, and when it fails, it returns false.
That is to say, when we judge whether add () is successful, we only need to judge whether the result is equal to false.
If ($result===false) {echo "add failed!" ;} else {echo "added successfully";} this article on "add method instance Analysis in thinkphp" ends here. Thank you for reading! I believe you all have a certain understanding of the knowledge of "case Analysis of add method in thinkphp". If you want to learn more, you are welcome to follow the industry information channel.
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.