控制器中有如下方法,
1.前端用$.post(url,data,callback)发请求:
let formData={"BoardID":data.field.board,"CategoryID":data.field.category,"ConfigID":data.field.config,"Title":data.field.title.trim(),"AuthorID":$.cookie('user_UID'),
"TypeID":data.field.type,"Content":editor.getData()
};
$.post("http://localhost/index.php/substance/Substance/publish",formData,function(res){
console.log(res);
});2.在控制器中,dump打印是有数据的(很完整)。3.问题:但是传到$this->hand->publish()方法中,就都为空了。(在publish()函数里,file_get_contents("php://input");也是空的)
public function publish(Request $request){
$info = $request->post();
dump($info);
// return $this->hand->publish($info);
} 最佳答案