我想知道如何编写自定义异常处理程序.
所以我可以做类似的事情
抛出新的dbException($sql,$message);
并输出
There was an error in your query
Message: {$message here}
Query: {$sql here}
Line: {line exception was thrown on}
File: {file exception was thrown from}
嗯,你可以
extend the
Exception
class但是你喜欢.对于自定义例外,您可能需要查看帖子:
> PHP 5 OOP: Delegation and Custom Exceptions
您还应该发现此线程有用: