显示错误的东西加上 [英] show something plus on error

查看:120
本文介绍了显示错误的东西加上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我的代码有错误,我想展示一些东西!

我该怎么办?

如果页面有错误显示图片

否则

显示页面

解决方案

您需要使用结构化异常处理http://en.wikipedia.org/wiki/Exception_handling [ ^ ]。



如果是PHP,您可以从手册中了解它的工作原理: http://php.net/manual/en/language.exceptions.php [ ^ ]。



对于一般的想法,请参阅我过去关于时间机器例外的答案:

C#构造函数中的异常会导致调用者分配失败吗? [ ^ ],

在操作系统中存储.net例外的地方 [ ^ ]。



-SA

i want to show something if my code has error!
what should i do?
if page has error show the image
else
show page

解决方案

You need to use structured exception handling: http://en.wikipedia.org/wiki/Exception_handling[^].

In case of PHP, you can learn how it all works from the manual: http://php.net/manual/en/language.exceptions.php[^].

For general ideas, please see my past answers about "exceptions as time machine":
Does Exception in C# Constructor Cause Caller Assignment to Fail?[^],
where was stored .net exceptions in operating system[^].

—SA


这篇关于显示错误的东西加上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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