ITeye博客

PHP【soap】

crizy · 2012-03-12 19:02 · php · 编程语言 · PHP · SOAP · Markdown

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

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。