$qr=mysql_query("SELECT `setting-name`,`setting-explain` FROM `fndn_Setting`");
$row=mysql_fetch_assoc($qr);
for($i=1;$row=mysql_fetch_assoc($qr);$i++){
$arr[$i]=$row;
}
echo json_encode($arr);
您好
json打印此值:
{"1":{"setting-name":"sms_num","setting-explain":"201300"},"2":{"setting-name":"sms_txt","setting-explain":"40"}}
但我想打印这个值:
{"1":{"sms_num","201300"},"2":{"sms_txt","40"}}
我该如何纠正?
答案 0 :(得分:0)
将一行更改为仅采用值
$arr[$i]=array_values($row);