dickrong 发表于 2017-3-4 12:22:18

php soap学习札记

首先建两个文件
server.php client.php
server.php里的内容为:

<?php
class Test{
function show(){
return "test content";
}
}
$server = new SoapServer(NULL, array("uri"=>"http://test-uri"));
$server->setClass("Test");
$server->handle()
?>


client.php里的内容为:

<?php
$soap = new SoapClient(NULL, array("location"=>"http://t.cn/soap/server.php", "uri"=>"http://test-uri"));
print_r($soap->__getFunctions());
echo $soap->show();
?>


我配置的apache的虚拟目录在F:盘下soap,通过
http://t.cn/soap/server.php
http://t.cn/soap/client.php
可以访问成功
在server.php端无任何表象
在client.php则会显示 test content
这里没有用到wsdl
页: [1]
查看完整版本: php soap学习札记