0
我得到一個類沒有找到,如果拋出一個不同的異常名
Fatal error: Class 'AException' not found in
當我拋出一個異常,使用不同的名稱比「異常」:
try
{
if (something) throw new AException('Error');
}
catch (AException $e)
{
$e->getMessage();
}
但是,如果我改變AException
與Exception
它的作品。 請幫忙嗎?
明顯的解決方案:包括其中AException定義文件? – Bert
要使用定製的異常,您需要創建一個擴展了PHP的Exception類的類,然後將該文件包含在程序中。 –
@Bert什麼文件? –