最大执行时间错误处理 [英] max execution time error handling

查看:121
本文介绍了最大执行时间错误处理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个脚本,有时会给最大执行时间达到错误。这是正常的,不是这个问题。问题是在这种情况下,我会写具体的错误信息。

我该怎么做?

解决方案

pre> function say_goodbye(){
if(connection_aborted()){
//如果用户已中止了事务$执行一些操作
} elseif(connection_status ()== CONNECTION_TIMEOUT){
//如果连接已超时,执行其他操作
} else {
//任何正常完成操作
}
}

register_shutdown_function(say_goodbye)

您还可以将参数传递给关闭功能


I have one script that sometimes gives Max execution times reached error. This is normal, not this a problem. The problem is that in this case I would write specific error message.
How do i do this?

解决方案

function say_goodbye() {
   if (connection_aborted()) {
      //  Perform some action if user has aborted the transaction
   } elseif (connection_status() == CONNECTION_TIMEOUT) {
      //  perform some other action if the connection has timed out
   } else {
      //  any normal completion actions
   }
}

register_shutdown_function("say_goodbye")

You can also pass parameters to the shutdown function

这篇关于最大执行时间错误处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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