/** * 獲取 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; }