PHP max_execution_time with includes


PHP max_execution_time with includes

只是在漫游max_execution_time是如何工作的。这里的文档说明了选项设置:

允许脚本运行的最长时间(秒)

include/require是如何工作的?

的例子:

file1.php
<?php
  include("file2.php");
  include("file3.php");
?>
file2.php
<?php
  //some script that takes 6 minutes
?>
file3.php
<?php
  echo "hello"
?>

如果file2.php需要6分钟(并且max_execution_time设置为5分钟),控制传递回file1.php并继续运行,还是整个文件退出?

执行中断并抛出错误。

最大执行时间是您的脚本可以执行的时间。不管你有多少个包含。因此,如果在任何时间点,脚本将耗尽时间,一切将停止,您将收到

致命错误:Maximum execution time of XX seconds exceeded