How to create web-services in Zend Framework?

爱⌒轻易说出口 提交于 2019-12-21 01:40:07

问题


How to create web services over HTTP REST protocol using Zend Framework?

An example code will be useful.


回答1:


<?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();
?>

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=Test

which will give output of

Hello world - Test


来源:https://stackoverflow.com/questions/4930146/how-to-create-web-services-in-zend-framework

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!