1

我在 CakePHP 2.1.2 中使用 FormHelper。当我发布包含许多元素分组的表单时,生成的 $request->data 数组在第 143 组截断。例如:

<?php
// going through a large for() loop using iterator $iter.

echo $this->Form->hidden('field1', array('name' => "Example[$iter][field1]", 'value' => 'field1'));
echo $this->Form->hidden('field2', array('name' => "Example[$iter][field2]", 'value' => 'field2'));
echo $this->Form->hidden('field3', array('name' => "Example[$iter][field3]", 'value' => 'field3'));
echo $this->Form->text('text', array('name' => "Example[$iter][text]", 'value' => ''));
?>

debug() 结果如下所示:

array(
    (int) 0 => array(
        'field1' => 'field1',
        'field2' => 'field2',
        'field3' => 'field3',
        'text' => 'something',
    ),
    (int) 1 => array(
        'field1' => 'field1',
        'field2' => 'field2',
        'field3' => 'field3',
        'text' => 'something else',
    ),
    ....
    (int) 142 => array(
        'field1' => 'field1',
        'field2' => 'field2',
    ),
);

在 $this->request->data['Example"] 中,第 143 组已损坏。我不知道这是如何发生的。任何想法都会非常有帮助。非常感谢。

4

2 回答 2

2

您可能需要提高max_input_varsphp.ini 中的值

于 2013-08-18T08:27:39.577 回答
0

几个建议:

  • 使用 Live HTTP Headers 之类的浏览器扩展程序来验证您的所有字段是否都包含在帖子中
  • 检查您的 php.ini 和/或 .htaccess 并确保 post_max_size 未设置为非常小的值
于 2013-08-15T17:45:53.300 回答