0
$("#gallery li.gallery-image-item:not(:first)").each(function() {
formData.append('gallery[]', {file: 'file', comment: 'comment', youTube: 'youtube'});
});
我使用formData和XMLHttpRequest将数据从js发送到php。从JS发送数组到PHP?
的问题是上述转储为一个字符串:
string(15) "[object Object]"
当我依次通过它:
foreach($input['gallery'] as $galleryImg) {
var_dump(($galleryImg));
}
我怎样才能访问它作为一个数组?我试过json.stringify和json解码+ json解码,在php方面是true。
没有运气。
这不是你想发送的数组。 –
为什么不是? – panthro
'append()'不是数组上的函数。你有没有尝试发送一个jQuery对象? – Ryan