【问题标题】:PHP max_execution_time with includesPHP max_execution_time 包含
【发布时间】:2014-10-11 15:52:33
【问题描述】:

只是想知道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 并继续运行,还是整个文件退出?

【问题讨论】:

    标签: php


    【解决方案1】:

    执行中断并抛出错误。

    【讨论】:

      【解决方案2】:

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

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

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2021-04-02
        • 2012-02-03
        • 2012-06-30
        • 2012-04-19
        • 2015-07-03
        • 2014-10-29
        • 2011-05-12
        • 1970-01-01
        相关资源
        最近更新 更多