try {
throw new \Exception('gateway.empty-gateway', 404);
} catch (Exception $e){
print_r($e);
}
如上面的代码,如果我直接使用的话,是可以 print_r($e);出内容来的 但是如果我放到自己定义的类中比如
namespace xxx
class test
{
public function run ()
{
try {
throw new \Exception('gateway.empty-gateway', 404);
} catch (Exception $e){
print_r($e);
}
}
}
这样就不行了,会直接打印出报错
Fatal error: Uncaught Exception: gateway.empty-gateway ...