开发者

How to create web-services in Zend Framework?

开发者 https://www.devze.com 2023-02-08 23:51 出处:网络
How to create web services over HTTP REST protocol using Zend Frame开发者_JS百科work? An example code will be useful.<?php

How to create web services over HTTP REST protocol using Zend Frame开发者_JS百科work?

An example code will be useful.


<?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
0

精彩评论

暂无评论...
验证码 换一张
取 消