【发布时间】:2013-04-09 22:51:00
【问题描述】:
当实现接口的类不包含请求的方法时,如何自定义错误消息?
其实我明白了:
Fatal error: Interface function X cannot contain body in Y on line Z
【问题讨论】:
-
我研究了这个解决方法:
@include_once $class OR die(); //sorry for the dirty @ if(error_get_last()) echo "<div class='error'><p>The module named $class_name is not correctly implemented.</p></div>"; else { ... }因为这个块在一个循环中,它显示了哪些类缺少接口方法。我知道这并不完美,但这是我找到的唯一解决方案。
标签: php oop interface error-handling fatal-error