[英]How to access data from http post request laravel?
An api provider post http request to my api url which look like this: http://somedomain.com/api/v1/handledata . An api provider post http request to my api url which look like this: http://somedomain.com/api/v1/handledata . I try to log data out but it always empty.我尝试注销数据,但它总是空的。
my api url like this我的 api url 像这样
Route::post('v1/handledata',[DataController::class, 'handleData']);
my controller like this我的 controller 像这样
public function handleData(Request $request){
return response()->json($request->all());
}
Your Method name and name in route are different.您的方法名称和路由中的名称不同。 Please.请。 Change route like this.像这样改变路线。 Method name is handleEvent
, but route is handleData
方法名称是handleEvent
,但路由是handleData
Route::post('v1/handledata',[DataController::class, 'handleEvent']);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.