Php 如何在Zend_Rest_客户端中使用POST发送数据

Php 如何在Zend_Rest_客户端中使用POST发送数据,php,zend-framework,rest,Php,Zend Framework,Rest,下一个代码是: $client = new Zend_Rest_Client('http://test.com/rest'); $client->sendData('data'); 如果我通过GET(echo$client->GET())发送,它工作正常 如果通过POST(echo$client->POST()),我将收到下一条消息“未指定任何方法” 如何使用Zend\u Rest\u客户端发送帖子?也许这有助于: $base_url = 'http://www.example.com'

下一个代码是:

$client = new Zend_Rest_Client('http://test.com/rest');
$client->sendData('data');
如果我通过
GET
echo$client->GET()
)发送,它工作正常

如果通过
POST
(echo$client->POST()
),我将收到下一条消息“未指定任何方法”

如何使用Zend\u Rest\u客户端发送帖子?

也许这有助于:

$base_url = 'http://www.example.com';
$endpoint = '/path/to/endpoint';
$data = array(
    'param1' => 'value1',
    'param2' => 'value2',
    'param3' => 'value3'
);
$client = new Zend_Rest_Client($base_url);
$response = $client->restPost($endpoint, $data);
print_r($response);

下面是Zend_Rest_Client类的链接,因为它表明我们可以使用公共方法
restPost()
执行post操作

restPost ($path, $data=null)
Performs an HTTP POST request to $path.