我在error.php中有以下代码,它是由我的控制器使用App::abort(404, $error)
触发的。然而,我的响应状态代码仍然是200(正常)。我尝试了各种错误代码,如400、403。
// NotFoundException handler
App::error(function(NotFoundException $e)
{
$default_message = 'The requested resource was not found';
return Response::json(array(
'error' => $e->getMessage() ?: $default_message,
), 404);
});