PHP Limit in POST variables

前端 未结 4 1725
花落未央
花落未央 2021-01-26 14:59

I\'m trying to send an array to a PHP script via POST method. First I serialize() it, then used base64_encode() on it. After receving it, the s

相关标签:
4条回答
  • 2021-01-26 15:46

    A php.ini value ir responsible for POST max size:

    post_max_size = 10M
    
    0 讨论(0)
  • 2021-01-26 15:51

    No need to worry about size, But I'd consider using sessions for this purpose

    0 讨论(0)
  • 2021-01-26 15:51

    1) The maximum amount of data you can POST is post_max_size directive in php.ini. See: http://www.php.net/manual/en/ini.core.php#ini.post-max-size

    2) Perhaps you can do it through $_SESSION?

    0 讨论(0)
  • 2021-01-26 15:53

    It would depend on the contents of the array. If it is mostly text, then you could compress/decompress using gzcompress/gzuncompress the resulting serialized object:

    $encoded = base64_encode(gzcompress(serialize($original)));
    
    $original = unserialize(gzuncompress(base64_decode($_POST['encoded'])));
    

    gzencode/gzdecode will probably give better compression for larger size data. If your aray contains binary data, or even worse compressed data, then this technique will probably not gain much if anything.

    In addition to the PHP configuration already mentioned, your web server can also impose POST size limits, for instance the LimitRequestBody directive in apache: http://httpd.apache.org/docs/2.2/mod/core.html#limitrequestbody

    0 讨论(0)
提交回复
热议问题