我正在使用Laravel-5.5,我正在为iOS应用程序开发一个API。
在这里,我使用postman调用所有API。我有一个带有两个标题的注册api:
(1)
Authorization: Bearer access_token
(2)
Content-type: application/x-www-form-urlencoded
现在,当我请求此api时,我只想打印
dd($request->all());
但它没有给我正确的请求数据。我试过了
json_decode(urldecode(file_get_contents('php://input')));
解码并尝试
$request->getContent();
但运气不好!
当使用时,是否有人知道如何在控制器中获取请求数据
内容类型:application/x-www-form-urlencoded
??
编辑:
public function registration(Request $request)
{
dd($request->all());
dd($request->getContent()); //also tried but not work
dd(json_decode(urldecode(file_get_contents('php://input')))); //no luck
}