PHP 之表单提交大数据,数据不完整

一、代码示例

前端test.html

<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
<form action="" method="post" class="we7-form" role="form" id="form">
    {$html}
    <input type="submit" value="提交">
    <input type="hidden" name="token" value="{$_W['token']}">
</form>
</body>
</html>

后端php

public function doWebTest(){
    global $_W, $_GPC;

    if ($_POST) {
        var_dump(count($_POST['check']));
        var_dump(count($_POST['content']));exit();
    }

    $html = "";
    for ($i = 0; $i < 3000; $i++) {
        $html .= "<input type=checkbox name=check[] value=$i checked> <input type=hidden name=content[] value='images/4/2021/05/AbtLa7b9jAttablTEbeA4ebB9w7atj.jpg' />";
    }
    include $this->template('test');
}

二、解决

 max_input_vars = 100000

posted @ 2021-07-05 10:09  样子2018  阅读(209)  评论(0编辑  收藏  举报