PHP头条
热点:

php调用webservice接口,乱码及报错的有关问题


php调用webservice接口,乱码及报错的问题
$client = new SoapClient('http://www.webxml.com.cn/WebServices/TraditionalSimplifiedWebService.asmx?wsdl');
$client->soap_defencoding = 'UTF-8';
$client->decode_utf8 = false;
$obj = $client->toTraditionalChinese(array('sText'=>'个'));
print_r($obj);
?>
这个是我写的一个调用网上公开的简繁转换的webservice的代码,我已经指定了soap_defencoding为UTF-8,decode_utf8设置成false,但是执行了之后提示【Encoding: string '\xb8...' is not a valid utf-8 string 】

请大家帮忙看看这个该怎么处理 分享到:
------解决方案--------------------
Encoding: string '\xb8...' is not a valid utf-8 string
传递的参数不是 utf-8 的串

就是说你的 array('sText'=>'' 不是utf-8 的
也就是说你的程序文件不是 utf-8 的
不过,如果是 utf-8 的,又何必声明字符集呢?


另外
$client->soap_defencoding = 'UTF-8';
$client->decode_utf8 = false;
是 nusoap 的写法

www.phpzy.comtrue/phprm/12031.htmlTechArticlephp调用webservice接口,乱码及报错的有关问题 php调用webservice接口,乱码及报错的问题 $client=newSoapClient('http://www.webxml.com.cn/WebServices/TraditionalSimplifiedWebService.asmx?wsdl'); $client->soap_defencodi...

相关文章

相关频道:

PHP之友评论

今天推荐