sunsir 发表于 2017-3-3 06:51:08

PHP【soap】

  1.php.ini里开启php_soap

extension=php_soap.dll
   2.server.php

<?php
class test {
public function hello() {
return 'Hello World!';
}
}
$options = array(
'uri' => 'http://127.0.0.1/soap/test',
);
$server = new SoapServer(null, $options);
$server->setClass('test');
$server->handle();

  3.client.php

<?php
$options = array(
'uri' => 'http://127.0.0.1/soap/test',
'location' => 'http://127.0.0.1/soap/server.php',
);
$client = new SoapClient(null, $options);
echo $client->hello();
  4.测试
  http://127.0.0.1/soap/client.php
页: [1]
查看完整版本: PHP【soap】