error_reporting(E_ALL);
//set_error_handler(function($errno, $errstr, $errfile, $errline){},E_ALL);
try {
$tag="hello world";
reset(explode(' ', $tag));
return $tag;
} catch (\Exception $e) {
throw new \yii\web\BadRequestHttpException($e->getMessage());
} catch (\Throwable $e) {
throw new \yii\web\BadRequestHttpException($e->getMessage());
}
-
如果想生产环境中屏蔽notice级别错误,可以设置error_reporting(E_ALL & ~E_NOTICE);
-
如果还想严格一点,既想记录notice信息又不报错,可以通过set_error_handler来接管错误
















