Method 1:
$ Projectlist = arr1tag ($ projectlist, array ('', 'select '), 'Project _ name'); // where $ list is a two-dimensional array with passed values, $ default is the default value. $ k is the specified table field function arr1tag ($ list, $ default = '', $ k ='') {$ TMP = ''; if (Array ($ list) {If (Array ($ default) {$ TMP [$ default [0] = $ default [1];} foreach ($ list as $ K1 =>$ V1) {$ TMP [$ k1 + 1] = $ V1 [$ K] ;}} return $ TMP ;}
Method 2:
$ Projectlist = arr2tag ($ projectlist, array ('', 'select '),''); // you can obtain the array_index2val ($ array, $ Index = 0) {$ value = ''; If (is_array ($ array) {$ I = 0; foreach ($ array as $ Val) {if ($ I ===$ index) {$ value = $ val; break;} $ I ++ ;}} return $ value ;} // convert the array in the database to an array that can use template tags. $ default is the default value, and $ k is the specified table field function arr2tag ($ arr, $ default = NULL, $ k = NULL) {$ TMP = ''; If (is_array ($ ARR) {If (is_array ($ default )) {$ TMP [$ default [0] = $ default [1]; if ($ type = 1) {$ TMP [$ default [2] = $ default [3] ;}} foreach ($ arr as $ key => $ Val) {If (is_array ($ k )) {$ TMP [$ Val [$ K [0] = $ Val [$ K [1];} else {$ TMP [array_index2val ($ Val, 0)] = array_index2val ($ Val, 1) ;}} return $ TMP ;}
Method 3:
Convert the read data from the database to a one-dimensional array. This method is mostly used for the select tag $ this-> where ($ where)-> getfield ('Id, name '); the obtained content is array ('id' => 'name ',)