【发布时间】:2018-06-30 01:06:17
【问题描述】:
我收到一个错误
PHP 致命错误:未捕获错误:无法抛出未实现 Throwable 的对象
我正在尝试抛出异常
if ($err){
throw new ShopException($err, $errno);
}
以及处理的异常类
class ShopException{
protected $error;
protected $errno;
function __construct($error,$errno)
{
$this->error= $error;
$this->errno= $errno;
}
function geterror() { return $this->error; }
}
任何帮助将不胜感激
【问题讨论】:
-
你需要
shopException extends Exception。 -
@musicliftsme 谢谢,当添加 extends Exception 时,页面不起作用,我收到错误此类 Exception not found.
标签: php exception exception-handling throw