问题描述
我想更改php设置,但从".php"页面而不是php.ini.我要更改的设置是
I want to change the php setting but from ".php" page not php.ini. The settings I want to change is
upload_max_filesize
,post_max_size
和memory_limit
推荐答案
在PHP中可以更改的唯一一个是最后一个,可以使用 ini_set 像这样:
The only one of those that can be changed from within PHP is the last one, which can be changed with ini_set like this:
ini_set('memory_limit', '32M');
PHP始终在启动PHP脚本之前处理客户端请求.这意味着在脚本开始之前,已上传的文件已经上传,并且已发布的表单已经完全发布.因此,无法在脚本中设置上载和发布设置,因为启动PHP脚本时它们已经无关紧要.
PHP always processes the client request before the PHP script is started. This means that uploaded files are already uploaded and posted forms are already fully posted beforeb he script starts. The upload and post settings can therefore not be set in the script, ebcause they are already irrelevant when the PHP script is started.
这篇关于如何从PHP代码更改PHP设置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!