我编码显示从数据库中获取单个数组。我想显示多个数组值,如下所示
{"newrelease" : [{"model" : "apple 6", "image": " photo.jpg" , "specs": ""}] }
我已编码$response['New Releases' ][]['Model'][$b['PhoneModel']] =$b['FileName'];
,输出为{"New Releases":[{"Model":{"desire-x":"_htc-desire-x-dual-sim.jpg"}}
答案 0 :(得分:0)
向您的array
newrelease
添加新的array
$response['newrelease'][] = array(
'model' => $b['PhoneModel'],
'image' => $b['FileName'],
'specs' => ""
);
echo json_encode($response);
答案 1 :(得分:0)
这应该是我认为的伎俩:
$response['newrelease'][] = array("model" => "apple 6", "image" => " photo.jpg" , "specs" => "");