I posted to the same yourAction() listed below and isPost returned true of course, isGet returned false.
So the only time isGet() is going to return false is when isPost() returns true?
You said "isGet() obviously does not give you the status..." It wasn't obvious to me. I thought I'd be able to test to see if a query was passed in the URL. Maybe this is due to a lack of experience....
I think the existence of the isGet() method is what confused me. When is it logical to use the isGet() method?
Maybe isQuery() would be more appropriate?
Thanks again for taking the time. I really appreciate it.
J
On Tue, Mar 17, 2009 at 10:09 AM, Sven Rautenberg <sven.rautenberg@mayflower.de> wrote:
J DeBord schrieb:
> Thanks Sven,But that's not what you have there. You can either have a GET request,
>
> Looking at the action below, and accessing it from
> http://localhost/controller/your
>
> public function yourAction() {
>
> $request = $this->getRequest();
>
> echo ($request->isPost() ? 'Is Post' : 'Is Not Post') . '<br />';
> echo ($request->isGet() ? 'Is Get' : 'Is Not Get') . '<br />';
>
>
> }
>
> Output:
>
> Is Not Post
> Is Get
>
> I would expect it to echo "Is Not Get."
or a POST request (besides any of the other requests that HTTP defines).
isGet() obviously does not give you the status whether or not the
request contained any query string or additional components within the
URL, but tells you what kind of HTTP request was received. And that has
to be GET at least.
See
http://framework.zend.com/manual/en/zend.controller.request.html#zend.controller.request.http.method
I think your misconception of what $_GET really is comes from the name
$_GET. This variable really should be named $_QUERY, because it does not
only exists with GET requests, but can exists with POST requests as
well. Just try <form action="target.php?test=get" method="post"> and
have a look at $_GET. :)
Regards,
Sven
没有评论:
发表评论