PHP接收json格式的POST数据application/json
浏览量:201
* 获取 post 参数; 在 content_type 为 application/json 时,自动解析 json
* @return array
*/
private function initPostData()
{
if (empty($_POST) ) {
$content = file_get_contents('php://input');
$post = json_decode($content,false);
} else {
$post = $_POST;
}
return $post;
}


感谢支持与鼓励~