PHP max_execution_time with includes

时间:2014-08-18 16:55:57

标签: php

徘徊max_execution_time的工作原理。 文档here表明该选项设置:

  

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

这对包含/需要有什么作用?

示例:

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并继续运行,或整个文件是否退出?

2 个答案:

答案 0 :(得分:1)

执行中断并抛出错误。

答案 1 :(得分:1)

最长执行时间是脚本执行的时间。不管你有多少包括在内。因此,如果在任何时间脚本将耗尽时间,一切都将停止,您将收到

  

致命错误:超过XX秒的最长执行时间