PHP: whats the total length of a post global variable?
I was wondering if anybody knows the total length that a post global could be. eg:
$_POST['formInput'] = "hello world, how long can i be?";
I am creating a site where someone will enter an unknown amount of chars into a textarea, so potentially it could be 2 pages on a word document. So if anybody knows of any other methods of how i can do this apart from using a post global? (it cant be saved in a file, as its important data that i dont want other people to find) That would be very helpful.
Thanks
Check your php.ini for post_max_size
. This is typically about 8mb by default, but if you're on shared-hosting, it could definitely vary.
; Maximum size of POST data that PHP will accept. post_max_size = 8M
You'll have to use $_POST
if you wish to send large amounts of data to the server. For further study, I'd suggest checking out POST Method Uploads in the documentation.
$_POST
is populated from the body of a HTTP-request. Since there are no restrictions on the size of a HTTP-request, there are no restrictions in the protocol layer. However PHP has some limitations on how much input it will read. You can control this with the ini-setting post_max_size
Another problem can be the default limit in php.ini for directive max_input_vars (default 1000), not only the post_max_size. If you have eg a very large form with thousands of checkboxes the $_POST array will have only 1000 keys.
链接地址: http://www.djcxy.com/p/22100.html下一篇: PHP:后期全局变量的总长度是多少?