如何在Zend Framework中创建Web服务? [英] How to create web-services in Zend Framework?
本文介绍了如何在Zend Framework中创建Web服务?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何使用Zend Framework通过HTTP REST协议创建Web服务?
How to create web services over HTTP REST protocol using Zend Framework?
示例代码将很有用.
推荐答案
<?php
// include zend framework in the include path
function methodname($var) {
echo "Hello world - $var";
}
$server = new Zend_Rest_Server();
$server->addFunction('methodname');
$server->handle();
?>
要调用此Web服务,请使用以下参数打开保存此PHP文件的URL
To call this web service, open the URL where you have saved this PHP file with the following arguments
http://www.example.com/index.php?method=methodname&var =测试
这将给出
Hello world - Test
这篇关于如何在Zend Framework中创建Web服务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文