结果出现错误:
Fatal error: Uncaught SoapFault exception: [SOAP-ENV:Server] SOAP-ERROR: Encoding: string '
不知道怎么解决这个问题
6 个解决方案
#1
服务器端的代码为:
文件名:services.php
<?
function getStrs($ab)
{
return "中国人";
}
$server = new SoapServer(null, array("uri" => "http://test-uri/"));
$server->addFunction("getStrs");
$server->handle();
?>
客户端:
client.php
<?
$a="a";
$params3 = array("ab"=>$a);
$as = $client->__soapCall("getStrs",$params3);
echo($as);
?>
结果输出:
Fatal error: Uncaught SoapFault exception: [SOAP-ENV:Server] SOAP-ERROR: Encoding: string '\xd6...' is not a valid utf-8 string
文件名:services.php
<?
function getStrs($ab)
{
return "中国人";
}
$server = new SoapServer(null, array("uri" => "http://test-uri/"));
$server->addFunction("getStrs");
$server->handle();
?>
客户端:
client.php
<?
$a="a";
$params3 = array("ab"=>$a);
$as = $client->__soapCall("getStrs",$params3);
echo($as);
?>
结果输出:
Fatal error: Uncaught SoapFault exception: [SOAP-ENV:Server] SOAP-ERROR: Encoding: string '\xd6...' is not a valid utf-8 string
#2
将字符转成utf-8
两头都转吧,因为相关xml默认是utf-8
两头都转吧,因为相关xml默认是utf-8
#3
不太懂..不过顶一个
#4
服务器端和客户端都要是utf-8
#5
使用utf-8编码就可以了
不懂utf-8,编码等就google
不懂utf-8,编码等就google
#6
我学习学习
#1
服务器端的代码为:
文件名:services.php
<?
function getStrs($ab)
{
return "中国人";
}
$server = new SoapServer(null, array("uri" => "http://test-uri/"));
$server->addFunction("getStrs");
$server->handle();
?>
客户端:
client.php
<?
$a="a";
$params3 = array("ab"=>$a);
$as = $client->__soapCall("getStrs",$params3);
echo($as);
?>
结果输出:
Fatal error: Uncaught SoapFault exception: [SOAP-ENV:Server] SOAP-ERROR: Encoding: string '\xd6...' is not a valid utf-8 string
文件名:services.php
<?
function getStrs($ab)
{
return "中国人";
}
$server = new SoapServer(null, array("uri" => "http://test-uri/"));
$server->addFunction("getStrs");
$server->handle();
?>
客户端:
client.php
<?
$a="a";
$params3 = array("ab"=>$a);
$as = $client->__soapCall("getStrs",$params3);
echo($as);
?>
结果输出:
Fatal error: Uncaught SoapFault exception: [SOAP-ENV:Server] SOAP-ERROR: Encoding: string '\xd6...' is not a valid utf-8 string
#2
将字符转成utf-8
两头都转吧,因为相关xml默认是utf-8
两头都转吧,因为相关xml默认是utf-8
#3
不太懂..不过顶一个
#4
服务器端和客户端都要是utf-8
#5
使用utf-8编码就可以了
不懂utf-8,编码等就google
不懂utf-8,编码等就google
#6
我学习学习