转自:https://blog.csdn.net/weixin_39983993/article/details/115504823
/**
* 获取 post 参数; 在 content_type 为 application/json 时,自动解析 json
* @return array
*/
private function initPostData()
{
if (empty($_POST) && false !== strpos($this->contentType(), 'application/json')) {
$content = file_get_contents('php://input');
$post = (array)json_decode($content, true);
} else {
$post = $_POST;
}
return $post;
}
更多精彩内容:各种AI课程、技能课程、黑科技软件、网站小程序源码、副业小项目、PPT模板等精品素材、电商课程、推广引流课程等,尽在 天边资源网 。