2
我对客户端和后端laravel有角度。当我尝试访问发送到使用输入laravel参数::得到(“params.id”)我得到空: 客户端POST请求:自定义http头设置为发布请求时,Laravel Input :: get('params.id')不工作
$http.defaults.headers.post = {'X-CSRF-Token':token};
$http.post('/projectx/public/provider/products/remove/'+PID,{
params:{
id:$scope.products[index].id,
title:$scope.products[index].title,
price:$scope.products[index].price
}
}).success(function(response){
if(response.status){
UI.simpleNotify('Product removed!','success');
}else{
console.log(response);
UI.simpleNotify('Error removing product!','error');
}
}).error(function(){
UI.connectionError();
});
这里是laravel后端代码:
$productId = Input::get('params.productId');
我试过Input :: all();但它返回null。
但是当我删除角度代码上的http自定义标题('X-CSRF-Token')它工作正常。
那么你认为这个问题是什么? 在此先感谢。
谢谢你,它完美的作品! – Miqe