我通过axios发布数据:
axios.post('/api/test', {
postId: 1,
userId: 1,
})
然后在Laravel后端,我通过以下方式获得请求:
use Illuminate\Http\Request;
....
public function store(Request $request)
{
dd($request->all());
}
但我收到错误:
Uncaught ErrorException: Array to string conversion
我已经转储了$ request,数据确实如此:
{"postId":1,"userId":1}