Zend&方法=“放”

时间:2012-10-23 15:37:31

标签: zend-framework methods put

我的应用似乎完全无视PUT操作。我有一个使用REST的GET,POST,PUT和DELETE操作的控制器。 PUT和DELETE方法似乎都被忽略了。也许这是一个动作和方法语法问题?

无论如何,这里有一些示例代码:

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

来自控制器:

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

在我的.htaccess中,我也允许所有GET POST PUT DELETE

我很困惑,它不起作用。请你帮忙,再次感谢!

这是表格:

<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 个答案:

答案 0 :(得分:0)

这篇文章Examples on Zend_Rest_Controller Unit Testing - 似乎有所帮助,虽然它看起来有点像黑客,但我现在就接受它了!