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);

posted on 2020-03-17 20:17  1450811640  阅读(1933)  评论(0编辑  收藏  举报