我将此值发送到PHP脚本,该脚本将rowData值保存到数据库。 这是POST参数:
amount 1
ident 1
orderID 101447
rowData [["0","","","","",""],["0","","","","",""],["0","","","","",""]]
storage 2
现在,我需要一种将PHP中的2D数组格式化为与rowData参数相同的格式的方法。 有人对我有提示或提示吗?
这是我的JS代码:
$.ajax({
type: "POST",
url: "http://127.0.0.1/some/dir/file.php",
data: {
orderID: orderID,
storage:storage,
ident:ident,
amount:amount,
rowData:rowData//this is the 2D Array
}
答案 0 :(得分:0)
使用 json 可以对数据进行操作,使用序列化代码会变得复杂;
其他方式可以是 fopen()
AND readfile()
OR 创建带有序列号的 XML 元素