$ _POST请求期间数据被切断

时间:2015-08-07 13:00:53

标签: php jquery ajax post

我无法确定以下$ _POST请求的问题。问题是我通过AJAX $ _POSTing一个包含855条记录的数组,但我的AJAX控制器只接收833.它总是收到相同的记录,并且它总是在同一点切出:

JQuery的:

var f = {};
f.chargeID = chargeID;
f.method = 'saveIndividualApplications';
f.individualAmounts = individualAmts;

processing.show();

console.log(f); //all records present
console.log(Object.keys(f.individualAmounts).length); //855

return $.ajax({
    type: 'post',
    cache: false,
    url: appControllerPath,
    data: f
});

PHP控制器:

$displayMaxSize = ini_get('post_max_size'); //125912
file_put_contents('post', $_SERVER['CONTENT_LENGTH'] . "\r\n"); //240M (increased this to 240 just to check)
file_put_contents('post', $displayMaxSize . "\r\n", FILE_APPEND);
file_put_contents('post', print_r($_SERVER, true), FILE_APPEND);
file_put_contents('post', count($_POST['individualAmounts']) . "\r\n", FILE_APPEND); //833
file_put_contents('post', print_r($_POST['individualAmounts'], true), FILE_APPEND); // data cuts off midway through 833rd record (although the array seems to close fine)

1 个答案:

答案 0 :(得分:8)

它可以受max_input_vars配置选项限制,默认情况下限制为1000.在5.3.9中生成,请检查PHP runtime config

或者,如果您使用的是Suhosin,则可能受其限制

[suhosin]
suhosin.request.max_vars = 1000
suhosin.post.max_vars = 1000
相关问题