php发送http请求,如何将参数格式化为application/x-www-form-urlencoded;charset=UTF-8

php发送http请求的请求参数类型可以为:

      1、content_type: application/json

      2、content_type: application/x-www-form-urlencoded;charset=UTF-8

对于json类型的数据:在php中使用json_encode进行转义

对于第二种数据类型:使用php函数http_build_query进行转换

$input = http_build_query($payload);

猜你喜欢

转载自www.cnblogs.com/ttaylor/p/12513050.html