我试图通过PUT方法更新我的记录
$client = new Zend_Http_Client();
$client->setMethod(Zend_Http_Client::PUT);
$client->setUri('http://example.com/api/type/');
$client->setParameterPost(array(
'useremail' => '*****@****.***',
'apikey' => 'secretkey',
'expenseid' => '4',
'description' => 'TEST WEB API',
'amount' => '5000.00',
));
然而它似乎不起作用。同样适用于 Zend_Http_Client :: DELETE 。 似乎只有 Zend_Http_Client :: POST 和 Zend_Http_Client :: GET 正在运行。
我错过了什么?
答案 0 :(得分:1)
我还不熟悉Zend Framework的实现,但您可能想要检查是否已将Apache配置为允许PUT和DELETE请求。
假设您使用的是虚拟主机和用户,请参阅以下文件:
.../apache/conf/extra/httpd-userdir.conf
在该文件中,确保您的目录的允许HTTP方法列表中包含PUT
和DELETE
。
<Directory ".../path-to-your-vhost-directory-here">
AllowOverride FileInfo AuthConfig Limit Indexes
Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
<Limit HEAD GET POST PUT DELETE OPTIONS>
Order deny,allow
Deny from all
Allow from localhost
</Limit>
<LimitExcept HEAD GET POST PUT DELETE OPTIONS>
Order deny,allow
Deny from all
</LimitExcept>
</Directory>
修改强>
你可以在这里找到该指令的官方文件:
http://httpd.apache.org/docs/current/mod/core.html#limit