dtw52353 2013-11-01 15:59
浏览 56
已采纳

当表单包含大量输入时,截断/缺少表单数据?

The Background
I am using CodeIgniter 2.1.4 and PHP 5.3 running on Nginx. I have an HTML form representing what is essentially rows of homogeneous data. Each "row" has several <input /> fields, each with the same name. Here's a simplified example:

<input type="text" name="firstname[]" />
<input type="text" name="lastname[]" />

So, I've got many firstname[] inputs, lastname[] inputs, etc. After submitting the form (the action is POST), I retrieve the data in a controller method like so (note that I'm using CodeIgniter):

$firstnames = $this->input->post('firstnames');
$lastnames = $this->input->post('lastnames');

These variables are arrays containing the values from the corresponding rows in the form, and from here I do some processing on this data.

The Problem
When the number of rows in the form is large (several hundred), the size of the resulting PHP arrays do not match the number of inputs in the form -- for example, the form might have 200 firstname inputs, but the $firstname array only has 167. What's more, the $lastname variable has a different size as well -- 166.

When the form has a smaller number of elements, everything works fine.

My theory is that I am exceeding some sort of maximum size setting or buffer somewhere in the stack, causing the form data to be truncated. Is there a PHP or CodeIgniter or nginx setting for "maximum form size" that I am not aware of?

For what it's worth, I have seen the same behavior when using both application/x-www-form-urlencoded or multipart/form-data as the content type for the form.

What am I missing?

  • 写回答

1条回答 默认 最新

  • duangu9173 2013-11-01 16:06
    关注

    Assuming no suhosin... Then see: max_input_vars and max_input_nesting_level.

    These are newer and often overlooked when people think of POST limits in PHP.

    But if its truncated like you say then maybe it is just your post_max_size.

    Also, this just has to be a dupe question...

    PHP max_input_vars Increasing the maximum post size etc..

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 关于smbclient 库的使用
  • ¥15 微信小程序协议怎么写
  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画