Convert Multidimensional PHP array to javascript array

后端 未结 4 1233
灰色年华
灰色年华 2021-01-12 11:23

I\'m trying to convert a PHP multidimensional array to a javascript array using the JSON encoder. When I do a var_dump, my php array looks like this:

array (         


        
4条回答
  •  执念已碎
    2021-01-12 11:58

    Do not use parseJSON, that's for a string. Just do:

    'a', 'Value'=>'asite.com');
    ?>
    
    
    
        
    
    
    
    
    

    This give me in the console:

    Object { Key="a", Value="asite.com"}
    

提交回复
热议问题