The difference between thinkphp's Select and find
Thinkphp is a good PHP development framework, can be more rapid development of the MVC architecture Management System, we need to use the Select () and the Find () method, two methods can return the array of datasets, but what is the difference? Let's take a look at my code comparison:
$tech =m (' techlevel ', ' Hr_cs_ ', ' db_config2 '); $Data = $tech->where (' id=1 ')->find ();d UMP ($Data); $Data = $tech- >where (' id=1 ')->select ();d UMP ($Data);
Results
Array (6) { ["ID"] = + int (1) ["techlevel"] = + string (2) "Ten" ["Remark"] + string (4) "??" ["createdate"] = + string (+) "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) "Ten"
["Remark"] + string (4) "??" ["createdate"] = + string (+) "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 a one-dimensional array, select () returns a two-dimensional array, so when the value is different, a one-dimensional array value with $data["Techlevel"], two-dimensional array values with $data[0][" Techlevel "], because at first did not understand this usage, debugging a day is not worth, finally have the dump method to see the difference between two methods!