使用 $request->json()->all()
使用這個方法獲取的是前端請求頭為Content-Type: application/json
傳過來的值。使用 $request->input()
會在json無值是去獲取query字段,不利於路由參數判斷
參見:
vendor\laravel\framework\src\Illuminate\Http\Request.php
vendor\symfony\http-foundation\ParameterBag.php