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

 PHP接收json格式的POST数据

 

相关文章:

  • 2021-05-26
  • 2022-12-23
  • 2022-12-23
  • 2022-02-03
  • 2022-12-23
  • 2022-12-23
  • 2021-08-06
  • 2021-12-13
猜你喜欢
  • 2022-12-23
  • 2022-02-16
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-29
相关资源
相似解决方案