javascript数组转换为php数组?
问题描述:
如何将javascript数组转换为php数组?
How can I convert a javascript array to a php array??
我有一个javascript数组,我想将值放入php数组$ b $请帮帮我?
I have a javascript array which I want to put the values into a php array please help me?
我将如何做到这一点?
答
你会通常使用 JSON.stringify $ c将数组转换为JSON字符串$ c>
,然后向服务器发出AJAX请求,接收字符串参数并 json_decode
它将返回PHP端的数组。
You would typically convert the array to a JSON string with JSON.stringify
, then make an AJAX request to the server, receive the string parameter and json_decode
it to get back an array in the PHP side.