简体   繁体   English

PHP如何查找允许的最大POST数据?

[英]PHP How to find maximum allowed POST data?

In PHP, is there a quick way to find the maximum allowed size of POST data for any server configuration that my script is run on? 在PHP中,有没有一种快速的方法来为运行我的脚本的任何服务器配置查找允许的POST数据的最大大小?

For example, $max_post_length = $_SERVER['maxpost']; 例如, $max_post_length = $_SERVER['maxpost']; or something. 或者其他的东西。 Perhaps it would return 0 for 'no limit'...any ideas? 也许它将为“无限制”返回0 ...任何想法?

使用ini_get

ini_get('post_max_size');

Try this: 尝试这个:

echo ini_get('post_max_size');

Or translate it to bytes: 或将其转换为字节:

echo (int)(str_replace('M', '', ini_get('post_max_size')) * 1024 * 1024);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM