我正在尝试使用 Zend Framework 编写一个简短的 Rest Service。但是这部分的文档并不是最好的。
我有一个 ApiController 扩展的 Zend_Rest_Controller,带有所有需要的抽象方法。我的目标是获取 Post 数据并返回一些东西。
我的客户是这样的:
public function indexAction()
{
$url = 'http://localhost/url/public/api';
$client = new Zend_Rest_Client();
$client->setUri($url);
$client->url = 'http://www.google.de';
$result = $client->post();
}
但是提供的“$client->url”不在服务器端的 post 数组中。我是否必须在 ApiController 的 postAction 中使用 Zend Rest Server?
如果有人有如何使用 Zend Rest 发送和获取数据的示例,那就太好了。
最佳答案
也许这个教程Create RESTful Applications Using The Zend Framework可以提供帮助。
关于php - 工作示例 Zend_Rest_Controller 与 Zend_Rest_Client?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1774928/