assigning multidimensional php array to javascript array

前端 未结 5 1580
梦如初夏
梦如初夏 2021-01-17 02:29

I know this may be a duplicate, but I cant wrap my brain around the other examples. Help would be appreciated. I have a php array that i need to assign to a javascript array

5条回答
  •  星月不相逢
    2021-01-17 03:18

    Your code is wrong because of what is generated by PHP (especially because you use numbers as variable names in JavaScript, plus you define the same variables with each loop).

    To simplify what you want to achieve, just create some variable in PHP and assign a value to it. Lets call it eg. $my_proxy_var.

    Then pass it to JavaScript like that (within some

提交回复
热议问题