代码如下:
client端
<?php
try{
$soap = new SoapClient(null, array('location' => "http://localhost/soap/soapserver.php",'uri' => "http://localhost/soap/",));
$name = "xxxxxxxx ";
$hello = $soap->sayHello($name);
print_r($hello);
}catch(SoapFault $fault)
{
echo "错误[$fault->faultcode]:fault->faultstring";
}
?>server端<?php
$soap = new SoapServer(null,array('uri' => "http://localhost/soap/",));
$soap->addFunction('sayHello');
$soap->handle();
function sayHello($name)
{
return "jdflsd";
if(!isset($name))
{
return new SoapFault('1','用户名不能为空!');
}
{
return 'Hello'.$name;
}
}
?>运行后结果如下:Fatal error: Maximum execution time of 30 seconds exceeded in G:\apache\htdocs\soap\soapclient1.php on line 13似乎超时了,不知道怎么办,我的soap已经安装好了,谢谢
client端
<?php
try{
$soap = new SoapClient(null, array('location' => "http://localhost/soap/soapserver.php",'uri' => "http://localhost/soap/",));
$name = "xxxxxxxx ";
$hello = $soap->sayHello($name);
print_r($hello);
}catch(SoapFault $fault)
{
echo "错误[$fault->faultcode]:fault->faultstring";
}
?>server端<?php
$soap = new SoapServer(null,array('uri' => "http://localhost/soap/",));
$soap->addFunction('sayHello');
$soap->handle();
function sayHello($name)
{
return "jdflsd";
if(!isset($name))
{
return new SoapFault('1','用户名不能为空!');
}
{
return 'Hello'.$name;
}
}
?>运行后结果如下:Fatal error: Maximum execution time of 30 seconds exceeded in G:\apache\htdocs\soap\soapclient1.php on line 13似乎超时了,不知道怎么办,我的soap已经安装好了,谢谢
返回 jdflsd
返回 jdflsd 我也不知道哪出问题了,似乎是function sayHello($name) 函数调用不到,是不是跟版本或者其他设置有关,可以确定的是soap初试化成功了,但是function sayHello($name)添加不进去,客户端调用就找不着了,把我搞郁闷了