關(guān)于“深度_遍歷_php”的問題,小編就整理了【1】個相關(guān)介紹“深度_遍歷_php”的解答:
php怎么把接受到的數(shù)據(jù)循環(huán)的添加到數(shù)組?遍歷數(shù)據(jù)表,把相應(yīng)的數(shù)據(jù)放到數(shù)組中即可例如:<
?php//定義一個數(shù)組,用于保存讀取到的數(shù)據(jù)$contents = array();$query = mysql_query("select * from table")
;//遍歷數(shù)據(jù)表while($array = mysql_fetch_array($query)){$contents[] = $array;
}print_r($contents)
;//然后循環(huán)數(shù)組,或者通過鍵名使用數(shù)組foreach($contents as $value){print_r($value);}echo $contents[0]['字段名稱'];?>
到此,以上就是小編對于“深度_遍歷_php”的問題就介紹到這了,希望介紹關(guān)于“深度_遍歷_php”的【1】點解答對大家有用。