JS二维数组转PHP二维数组
如题,,JS数组如下:varjsArray=[{"0":"aaa","1":"bbb","2":"ccc"},{"0":"aaa","1":"bbb","2":"ccc"...
如题,,
JS数组如下:
var jsArray = [{"0":"aaa","1":"bbb","2":"ccc"},{"0":"aaa","1":"bbb","2":"ccc"},{...}];
用AJAX如何提交至PHP,并且得到类似的数组
如:$phpArray = array(array(0=>"aaa",1=>"bbb",2=>"ccc"),array(0=>"aaa",1=>"bbb",2=>"ccc"),array()); 展开
JS数组如下:
var jsArray = [{"0":"aaa","1":"bbb","2":"ccc"},{"0":"aaa","1":"bbb","2":"ccc"},{...}];
用AJAX如何提交至PHP,并且得到类似的数组
如:$phpArray = array(array(0=>"aaa",1=>"bbb",2=>"ccc"),array(0=>"aaa",1=>"bbb",2=>"ccc"),array()); 展开
展开全部
var jsArray = [{"0":"aaa","1":"bbb","2":"ccc"},{"0":"aaa","1":"bbb","2":"ccc"}];
var data = JSON.stringify(jsArray);
然后ajax post 到php
<?php
$str = '[{"0":"aaa","1":"bbb","2":"返空ccc"},{"0":"aaa","1":"bbb","2":"ccc"}]'漏御瞎;
$a 拆虚= json_decode($str);
var_dump($a);
追问
PHP页面是如何接收JS传过来的数组,然后保存为PHP数组的呢
追答
你查询下jquery ajax post的时候如何添加自定义的数据(比如a=data),添加一个项, 然后php 通过$_POST['a']
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询