曾德& method =“放入" [英] Zend & method="put"
问题描述
我的应用似乎完全忽略了PUT动作.我有一个使用REST进行GET,POST,PUT和DELETE操作的控制器. PUT和DELETE方法似乎都被忽略了.也许是动作和方法语法问题?
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');
}
从控制器:
public function putAction()
{
echo "putAction";exit();
}
在我的.htaccess文件中,我还允许所有GET POST PUT DELETE删除
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!
这是表格:
<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"> </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"> </dt><dd id="submit-element">
<input type="submit" name="submit" id="submit" value="Update Article" /></dd></dl></form>
推荐答案
此帖子有关Zend_Rest_Controller单元测试的示例-虽然看起来有点hack,但似乎有所帮助,但我现在就讲吧!
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!
这篇关于曾德& method =“放入"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!