Javascript POST后PHP中对象的值与通过Ajax发送的值不匹配?

Javascript POST后PHP中对象的值与通过Ajax发送的值不匹配?,javascript,php,ajax,Javascript,Php,Ajax,因此,在我的JavaScript中,我创建了一个对象,如果我console.log(data[71])我得到: as_of_date "2014-01-31" class_index "Class C" fund_no 13 with_load 1 y2004 0 y2005 0 y2006 0 y2007 0 y2008 0 y2009 0 y2010 "9.46%" y2011 "-0.20%"

因此,在我的JavaScript中,我创建了一个对象,如果我
console.log(data[71])
我得到:

as_of_date
    "2014-01-31"
class_index
    "Class C"
fund_no
    13
with_load
    1
y2004
    0
y2005
    0

y2006
    0
y2007
    0
y2008
    0
y2009
    0
y2010
    "9.46%"
y2011
    "-0.20%"
y2012
    "9.91%"
y2013
    "30.48%"
在我的php中,我有一个foreach,它遍历发布的每个对象:

    if($_POST['function'] == 'update_calendar_year') {
        $entries = $_POST['data'];
        foreach ($entries as $entry) {
            $fund_no = $entry['fund_no'];
            $y2004 = preg_replace('/[&%$]+/', '', $entry['y2004']);
            $y2005 = preg_replace('/[&%$]+/', '', $entry['y2005']);
            $y2006 = preg_replace('/[&%$]+/', '', $entry['y2006']);
            $y2007 = preg_replace('/[&%$]+/', '', $entry['y2007']);
            $y2008 = preg_replace('/[&%$]+/', '', $entry['y2008']);
            $y2009 = preg_replace('/[&%$]+/', '', $entry['y2009']);
            $y2010 = preg_replace('/[&%$]+/', '', $entry['y2010']);
            $y2011 = preg_replace('/[&%$]+/', '', $entry['y2011']);
            $y2012 = preg_replace('/[&%$]+/', '', $entry['y2012']);
            $y2013 = preg_replace('/[&%$]+/', '', $entry['y2013']);
            $with_load = preg_replace('/[&%$]+/', '', $entry['with_load']);
当我到达最后一个条目时,出现以下错误:

<b>Notice</b>:  Undefined index: y2006 in <b>/home/diamondh/public_html/wp-content/themes/diamond-hill/functions.php</b> on line <b>69</b><br />
<br />
<b>Notice</b>:  Undefined index: y2007 in <b>/home/diamondh/public_html/wp-content/themes/diamond-hill/functions.php</b> on line <b>70</b><br />
<br />
所有其他传递的值都是正确的。它似乎只是最后一个由于某种原因被截断一半值的对象?上面的var_dump应显示与上面的my console.log相同的值,但不显示

在挫折中,我尝试只将数据[71]传递给我的php,但值是正确的:

    $.ajax({
      type: "POST",
      url: "functions.php",
      data: {
        function: "update_calendar_year",
        data: data[71]          
      },
      success: "success",
      dataType: "json"
    });
如果我检查传入PHP的内容,我会得到:

array(14) {
  ["fund_no"]=>
  string(2) "13"
  ["class_index"]=>
  string(7) "Class C"
  ["with_load"]=>
  string(1) "1"
  ["y2004"]=>
  string(1) "0"
  ["y2005"]=>
  string(1) "0"
  ["y2006"]=>
  string(1) "0"
  ["y2007"]=>
  string(1) "0"
  ["y2008"]=>
  string(1) "0"
  ["y2009"]=>
  string(1) "0"
  ["y2010"]=>
  string(5) "9.46%"
  ["y2011"]=>
  string(6) "-0.20%"
  ["y2012"]=>
  string(5) "9.91%"
  ["y2013"]=>
  string(6) "30.48%"
  ["as_of_date"]=>
  string(10) "2014-01-31"
}
这正是我所期望的


抱歉,这是一个冗长的问题,但这是一个非常奇怪的问题,我已经尝试了所有我能想到的方法,并且已经仔细检查了所传递的内容。

PHP限制了1000个post字段

您有71*14个字段=994

然后,下一组14个字段被截断了一半

有关更多信息,请查看


要么增加maxpost字段,要么重构代码和用户界面,一次性处理更少的字段。

谢谢,我不知道PHP有这个限制。当我进入办公室时,我会看看这是否有效,并检查你的答案=)
array(14) {
  ["fund_no"]=>
  string(2) "13"
  ["class_index"]=>
  string(7) "Class C"
  ["with_load"]=>
  string(1) "1"
  ["y2004"]=>
  string(1) "0"
  ["y2005"]=>
  string(1) "0"
  ["y2006"]=>
  string(1) "0"
  ["y2007"]=>
  string(1) "0"
  ["y2008"]=>
  string(1) "0"
  ["y2009"]=>
  string(1) "0"
  ["y2010"]=>
  string(5) "9.46%"
  ["y2011"]=>
  string(6) "-0.20%"
  ["y2012"]=>
  string(5) "9.91%"
  ["y2013"]=>
  string(6) "30.48%"
  ["as_of_date"]=>
  string(10) "2014-01-31"
}