使用 ini_set('max_execution_time', 0); [英] On using ini_set('max_execution_time', 0);

查看:38
本文介绍了使用 ini_set('max_execution_time', 0);的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用ini_set('max_execution_time', 0);?

问题 1:我是将它放在 .PHP 文件的顶部还是放在需要很长时间才能执行某事的函数中?

Question 1: Do I place it at the top of the .PHP file or in a function that takes a long time to do something?

问题 2:此设置是否在设置后永久有效?还是在函数停止运行后返回到原来的 300 秒或任何默认值?

Question 2: Does this setting last forever after being set? Or does it return back to its original 300sec or whatever default value after the function stops running?

推荐答案

你可以把它放在任何地方,但该设置在它运行之前不会生效.所以如果你把它放在顶部,那么脚本永远不会超时.如果你把它放在可能需要一段时间的函数下面,那么如果脚本需要很长时间才能到达你调用它的地方,你可能会在上面得到超时.

You can place it anywhere, but that setting won't take effect until it runs. So if you put it at the top, then the script will never timeout. If you put it down below on the function that can take awhile, then you may get a timeout above if the script takes a long time to get to where you called it.

当您使用 ini_set() 时,该选项在脚本的整个执行过程中一直有效.

When you use ini_set() that option stays in effect for the entire execution of the script.

这篇关于使用 ini_set('max_execution_time', 0);的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆