2010-07-28 43 views
3

正在嘗試通過PUT方法一個Zend_Http_Client :: 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', 
)); 

更新我的記錄但它似乎並沒有work.The同樣也適用於一個Zend_Http_Client ::刪除。 似乎只有Zend_Http_Client :: POSTZend_Http_Client :: GET正在工作。

我錯過了什麼?

回答

1

我對Zend Framework的實現還不熟悉,但您可能想要檢查您是否配置了Apache來允許PUT和DELETE請求。

假設你正在使用虛擬主機和userdirs,請參閱以下文件:
.../apache/conf/extra/httpd-userdir.conf

在該文件中確保您在爲您的目錄允許的HTTP方法列表中有PUTDELETE

<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