curl提交数据时中文乱码

1.使用curl提交数据时中文乱码解决:

<?php  

$testJSON=array('name'=>'中文字符串','value'=>'test');  

foreach ( $testJSON as $key => $value ) {  

        $testJSON[$key] = urlencode ( $value );  

echo urldecode ( json_encode ( $testJSON ) ); 

?> 

注意:json_decode($string,true),第二个参数为true时,返回的结果是数组array而不是对象

原文地址:https://www.cnblogs.com/xlz307/p/4402797.html