增加 PHP 脚本执行时间
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5140258/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Increase PHP Script Execution Time
提问by PHP Ferrari
I want to send hundreds of emails using PHP. To increase the execution time, I used ini_set('max_execution_time', 10);but after sending just 30emails the browser shows me a blank page and does not send all of the emails.
我想使用 PHP 发送数百封电子邮件。为了增加执行时间,我使用了ini_set('max_execution_time', 10); 但是在仅发送30封电子邮件后,浏览器向我显示了一个空白页面,并且没有发送所有电子邮件。
I also changed the limit to 300, 600 ..
我还将限制更改为 300、600 ..
回答by Richard Pianka
Try set_time_limit(0);
at the top of your script.
set_time_limit(0);
在脚本的顶部尝试。
set_time_limitsets the maximum execution time in seconds. If set to zero, no time limit is imposed (see PHP manual).
set_time_limit以秒为单位设置最大执行时间。如果设置为零,则没有时间限制(参见PHP 手册)。