How do I encode a PHP array to a JSON array, not object?

前端 未结 4 867
你的背包
你的背包 2020-12-09 20:39

I am trying to json_encode an array which is returned from a Zend_DB query.

var_dump gives: (Manually adding 0 member does not change the picture.)

a         


        
4条回答
  •  离开以前
    2020-12-09 21:29

    A common way to test for a traditional, continuous array in php is to check for an index '0'. Try adding that to your array, it'll probably considering it an array instead of hashmap.

提交回复
热议问题