PHP【soap】
1.php.ini里开启php_soapextension=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]