我在将 $.post 中的数组发送到 php 时遇到问题。 var_dump 结果为“NULL” JSON.stringify 不起作用..
JQUERY
var photobox = [];
photobox.push(e.target.result);
$.post("../modules/upload.php",{"images[]" : photobox, count : sum},
function(data)
{
$('.list').prepend(data);
}).done(function() {
$('#files').prop('disabled', false);
$('.file-search').html("Szukaj...");
$(".img-thumbnail").removeClass("first");
$(".img-thumbnail").first().addClass("first");
e.target.result is base64 code
PHP
$images = $_POST['images'];
var_dump($images);
最佳答案
您可以像这样发送数组:
$.post('/thepage.php', {'NameOfKey': variableName});
上面的代码将允许 VariableName 是一个数组。
关于javascript - $.post Jquery发送数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44101488/