第一种方式:

Content-Type: application/x-www-form-urlencoded

post体为:user_id=1&user_source=web&is_new=1

接口中获取数据:$_POST['user_id']

关于POST请求接口Content-type对应数据格式及接口中对数据的获取

第二种方式:

Content-Type: application/json

post体为json:{"user_id":"1","user_source":"web","is_new":"1"}

接口中获取数据:file_get_contents("php://input");

                $xmldata = file_get_contents("php://input"); 
                $data = (array)simplexml_load_string($xmldata); 



相关文章: