📜  laravel 中止 - PHP 代码示例

📅  最后修改于: 2022-03-11 14:54:51.550000             🧑  作者: Mango

代码示例1
abort(403);

//You may also provide the exception's message and custom 
//HTTP response headers that should be sent to the browser:
abort(403, 'Unauthorized.', $headers);

abort_if()
//The abort_if function throws an HTTP exception if a given
//boolean expression evaluates to true:

abort_if(! Auth::user()->isAdmin(), 403);