-1
$test = array('hola'=>'mundo','salami'=>'frito');
$data = array(
'gift_promoted' => '',
'questions' => array(
0 => array(
'extra' => array()
)
),
'quiz' => array(
'extra' => array(),
$test
)
);
print json_encode($data);
實際結果:如何刪除這個 「0」:{從陣列
{"gift_promoted":"","questions":[{"extra":[]}],"quiz":{"extra":[],"0":{"hola":"mundo","salami":"frito"}}}
我需要的是這樣的:
{"gift_promoted":"","questions":[{"extra":[]}],"quiz":{"extra":[],"hola":"mundo","salami":"frito"}}
你可以使用'unset'。 –
重複是錯誤的。這個問題是關於將[0 => $ v]更改爲$ v,這不是完全刪除一個元素。 – SOFe
問題確實沒有重複 –