我正在尝试让 SOAP Web 服务与 PHP 一起运行。但是当我运行文件时,页面什么也没有显示。我试图创建一个客户端来查看代码是否以这种方式运行,但函数没有运行。这是我的代码:
网络服务.php
function hello(){
echo("hi");
}
$server = new SoapServer(null, array('uri'=>'http://localhost/FutureWB/hello'));
$server->addFunction("hello");
$server->handle();
测试网.php
try{
$client = new SoapClient(null, array(
'location'=>"http://localhost/FutureWB/functions/webservice.php",
'uri' => "http://localhost/FutureWB/hello"
));
$result = $client->hello();
echo($result);
}catch(SoapFault $ex){
$ex->getMessage();
}