$nesAry=array();
$nesAry["name"]="abc";
$nesAry["email"]="[email protected]";
$nesAry1=array();
$nesAry1["name"]="abc1";
$nesAry1["email"]="[email protected]";
$nesAry2=array();
$nesAry2["name"]="abc2";
$nesAry2["email"]="[email protected]";
$responseAry = array();
$responseAry[0]=$nesAry;
$responseAry[1]=$nesAry1;
$responseAry[2]=$nesAry2;
echo json_encode($responseAry); // here output like this => [{"name":"abc","email":"[email protected]"},{"name":"abc1","email":"[email protected]"},{"name":"abc2","email":"[email protected]"}]
unset($responseAry[1]);
echo "------------removed 1--------";
echo json_encode($responseAry); // but here output like this => {"0":{"name":"abc","email":"[email protected]"},"2":{"name":"abc2","email":"[email protected]"}}
我想出來把篩選移除元素\ n [{「名」之後:「ABC」,「電子郵件」:「[email protected]」 },{ 「名」: 「ABC2」, 「電子郵件」: 「[email protected]」}]刪除陣列的給定鍵的元素在PHP
請幫我
([使用PHP json_encode當刪除數組索引參考] https://stackoverflow.com/q最終陣列/ 20372982/6521116) –