0
我想有這兩個標籤的一個數組,所以我可以使用兩種標籤從索引中PHP破滅兩個標記成一個陣列
$query = "SELECT username,imgDefault from users"
$result = $sql->query($query);
$rows = array();
while($row = $result->fetch_assoc()) {
$rows[]=$row;
}
$result->close();
$sql->close();
$str = implode(',', array_map(function($el){ return $el['username']; }, $rows));
$str1 = implode(',', array_map(function($el){ return $el['imgDefault']; }, $rows));
所需的輸出數組
username:"d" imgDefault: "a", username:"b" imgDefault: "q", etc....
通過我的客戶引用它
我打開任何其他輸出,可以幫助我確定索引列值
不要刪除(http://stackoverflow.com/questions/31529216/php-implode-multiple-tags-in-same-array)和轉發 - 它非常粗魯 – 2015-07-21 02:27:05
即時消息不知道你在問什麼。你能展示你想要達到的「最終結果」嗎?也就是說,顯示你試圖獲得的數組是如何構造的 – chiliNUT
你的問題是什麼? – alariva