Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/275.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php laravel中的Angular js post请求返回null_Php_Angularjs_Laravel_Laravel 5 - Fatal编程技术网

Php laravel中的Angular js post请求返回null

Php laravel中的Angular js post请求返回null,php,angularjs,laravel,laravel-5,Php,Angularjs,Laravel,Laravel 5,这是我的请求 route.service('MetaDataService',function ($http) { $http.defaults.headers.post["Content-Type"] = "application/x-www-form-urlencoded"; this.newItem = function (url,data) { console.log(data); return $http.post('/

这是我的请求

 route.service('MetaDataService',function ($http) {


   $http.defaults.headers.post["Content-Type"] = "application/x-www-form-urlencoded";

    this.newItem = function (url,data) {
           console.log(data);
           return $http.post('/'+url,data).then(function (response) {
               return response.data.status;
           });
       }

    });
拉威尔控制器

dd$request->all returns[]数组

我还记录了请求控制台之前的数据。logdatait将给出ouptut

请求头

尝试以

dd($request->json()->all());

您使用的请求是否正确

use Illuminate\Http\Request;

实际上,angular js作为原始数据发送,可通过以下方式检索:

file_get_contents("php://input");
在Laravel中,有一种首选或推荐的方式:

$request = Request::instance();
$content = $request->getContent();


快乐编码

您能给我们看一个示例数据吗?[name:hello]控制台的输出。logdata@Demonyowh你知道吗?你在控制台中是否遇到了诸如访问控制允许源代码之类的错误?不,没有CORS issuesTried,但返回空的arrayCheck天气文件\u get\u contents'php://input“给了你一些东西。或者您可以使用$request->namehmmm。。。等待同样的结果。
file_get_contents("php://input");
$request = Request::instance();
$content = $request->getContent();
$content = Request::getContent();