好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

NuSOAP 调用 Web Service 出现乱码的解决方法 - php高级

NuSOAP 调用 Web Service 出现乱码的解决方法

实际上,开启了调试功能的朋友,相信会发现 $client->response 返回的是正确的结果,为什么 $result = $client->call($action, array(‘parameters’ => $param)); 却是乱码呢? 

研究过 NuSOAP 代码后我们会发现,当 xml_encoding 设置为 UTF-8 时,NuSOAP 会检测 decode_utf8 的设置,如果为 true,会执行 PHP 里面的 utf8_decode 函数,而 NuSOAP 默认为 true,因此,我们需要设置:

$client ->soap_defencoding =  'utf-8' ;  $client ->decode_utf8 = false;  $client ->xml_encoding =  'utf-8' ; 

查看更多关于NuSOAP 调用 Web Service 出现乱码的解决方法 - php高级的详细内容...

  阅读:57次