【问题标题】:Can I configure Apache to redirect at a specified timeout?我可以将 Apache 配置为在指定的超时时间重定向吗?
【发布时间】:2011-07-20 09:28:04
【问题描述】:

I 如何配置 Apache,以便我可以在指定的 TimeOut 时重定向到另一个页面。这可能吗?

【问题讨论】:

    标签: apache apache-config


    【解决方案1】:

    没有找到任何可能的解决方案如何在 Apache 中执行此操作。

    不过,如果您使用的是 PHP,请尝试使用 PHP register_shutdown_function 函数。

    示例代码:

    set_time_limit(1);
    function shutdown () {
        if ( ! defined('FINISHED')) {
            header('Location: /timeout');
        }
    }
    
    register_shutdown_function('shutdown');
    
    while (true) {}
    
    define('FINISHED', 1);
    

    这仍然会在致命错误以及在您的脚本中手动调用 die()exit() 之后执行。

    【讨论】:

      猜你喜欢
      • 2015-03-26
      • 1970-01-01
      • 1970-01-01
      • 2011-12-18
      • 2015-09-02
      • 2020-06-01
      • 2019-05-21
      • 1970-01-01
      • 2010-09-12
      相关资源
      最近更新 更多