Zend & method=“put”

自作多情 提交于 2019-12-12 00:55:58

问题


My app seems to be completely ignoring the PUT action. I have a controller with GET, POST, PUT and DELETE actions using REST. Both PUT and DELETE methods seem to be ignored. Perhaps it's an action and method syntax issue?

Anyway here is some sample code:

public function init()
{
    // Set the method for the display form to PUT
    $this->setMethod('PUT');
    $this->setAction('/article/?update');
}

From Controller:

public function putAction()
{
    echo "putAction";exit();
}

In my .htaccess I also allow from all GET POST PUT DELETE

I'm confused, it's not working. Please can you help, thanks again!

This is the form:

<form articleid="17" articlename="1" articlecontent="1" topicidfk="1" topicid="1" topicname="Sports" method="put" action="/article?update"><dl class="zend_form">
<dt id="articlename-label"><label for="articlename" class="required">Article Name</label></dt>
<dd id="articlename-element">
<input type="text" name="articlename" id="articlename" value="1" /></dd>
<dt id="articlecontent-label"><label for="articlecontent" class="required">Article Content</label></dt>
<dd id="articlecontent-element">
<textarea name="articlecontent" id="articlecontent" rows="4" cols="80">1</textarea></dd>
<dt id="topicidfk-label">&#160;</dt>
<dd id="topicidfk-element">
<select name="topicidfk" id="topicidfk">
    <option value="0" label="Select One">Select One</option>
    <option value="1" label="Sports" selected="selected">Sports</option>
    <option value="2" label="Finance">Finance</option>
</select></dd>
<dt id="submit-label">&#160;</dt><dd id="submit-element">
<input type="submit" name="submit" id="submit" value="Update Article" /></dd></dl></form>   

回答1:


This post Examples on Zend_Rest_Controller Unit Testing - seems to have helped although it looks like a bit of hack but I'll take it for now!



来源:https://stackoverflow.com/questions/13034145/zend-method-put

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!