捕获 set_time_limit() 已达到 - PHP [英] Capturing set_time_limit() reached - PHP

查看:43
本文介绍了捕获 set_time_limit() 已达到 - PHP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能的重复:
如何捕获致命错误:PHP 中的最大执行时间超过 30 秒

我之前用过很多次set_time_limit(60);.但是当超过这个值时是否有任何捕获,目前它只是以相同的旧错误轰炸.

I have used set_time_limit(60); many times before. But is there anyway of capturing when this is exceeded, at the moment it just bombs with the same old error.

我想捕获它失败然后以我自己的方式处理它?<​​/p>

I want to capture it failing and then handle it in my own way?

推荐答案

来自 php.net 的评论部分 set_time_limit

From comment section in php.net for set_time_limit

<?php
set_time_limit(60);
ob_start();
function shutdown () {
  $out = ob_get_clean();echo $out; // echo output if required
  // do your processing code
}
register_shutdown_function('shutdown');

// your code
?>

这篇关于捕获 set_time_limit() 已达到 - PHP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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