In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article will explain in detail the difference between find and select in thinkphp. The content of the article is of high quality, so the editor will share it with you for reference. I hope you will have a certain understanding of the relevant knowledge after reading this article.
The difference: 1. Find () looks for the first piece of data that meets the criteria and returns an one-dimensional array, while select () looks for all the data that meets the criteria and returns a two-dimensional array. 2. The value of find () result is "$data [" key name "]", while the value of select () result is "$data [0] [" key name "]".
The operating environment of this tutorial: windows7 system, thinkphp5 version, DELL G3 computer.
Thinkphp is a good php development framework, which can quickly develop the management system of MVC architecture. We need to use the select () and find () methods, both of which can return an array of datasets, but what's the difference? Take a look at my code comparison first:
$tech=M ('techlevel','HR_CS_','DB_CONFIG2'); $Data=$tech- > where (' id=1')-> find (); dump ($Data); $Data=$tech- > where ('id=1')-> select (); dump ($Data)
Results:
Array (6) {["ID"] = > int (1) ["TechLevel"] = > string (2) "10" ["Remark"] = > string (4) "thanks" ["CreateDate"] = > string (19) "2013-03-14 15:14:38" ["CreateBy"] = > string (5) "admin" ["ROW_NUMBER"] = > string (1) "1"} array (1) {[0] = > array (6) {["ID"] = > int (1) ["TechLevel"] = > string (2) "10" ["Remark"] = > string (4) "thanks" ["CreateDate"] = > string (19) "2013-03-14 15:14:38" ["CreateBy"] = > string (5) "admin" ["ROW_NUMBER"] = > string (1) "1"}}
As can be seen from the above code, find () returns an one-dimensional array, select () returns a two-dimensional array, so the value is different. One-dimensional array is valued with $data ["TechLevel"], and two-dimensional array is valued with $data [0] ["TechLevel"]. Because you do not understand this usage at the beginning, you can not take a value for a day of debugging, and finally there is a dump method to see the difference between the two methods!
About how the difference between find and select in thinkphp is shared here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.
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.