带有文件获取内容(';php://input')
在vanilla php中,我将创建一个callbak url,只需带有文件获取内容(';php://input'),php,laravel,Php,Laravel,在vanilla php中,我将创建一个callbak url,只需 try { //response content type application/json header("Content-Type:application/json"); //read incoming request $postData = file_get_contents('php://input'); .....
try
{
//response content type application/json
header("Content-Type:application/json");
//read incoming request
$postData = file_get_contents('php://input');
.......
......
但在拉威尔,我还没有得到一个关于如何实现同样目标的明确解释
我试过使用
$postData = Request::getContent();
但是,如果您在请求use
(new\illumb\Http\request())->all()或use DI()中需要数据,它将返回空白
public function someAction(\Illuminate\Http\Request $request)
{
dd($request->all());
}
您使用哪种外观进行请求?这是为了什么?如果要从输入中读取JSON数据,则request()->JSON(“点分隔路径”)
可以工作。另外,request()->all()
也可以工作。是的,目的是读取json数据。和im对请求使用\light\Http\Request