2009年3月17日星期二

Re: [fw-mvc] GET array sent with every request?

Thanks Sven,

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."

My goal is to require Get parameters to be set else redirect away from this action.

Thanks a lot

Jason

Limoges, FRANCE


On Tue, Mar 17, 2009 at 8:56 AM, Sven Rautenberg <sven.rautenberg@mayflower.de> wrote:
J DeBord schrieb:
> Is there an empty _GET array sent with every request? For some reason
> all of my requests contain an empty GET array even when I have not
> /knowingly/ passed anything.

Yes, that is basic PHP behaviour. You have to expect empty $_GET, $_POST
and $_COOKIE arrays no matter what kind of request was sent (GET vs. POST).

Regards,
Sven



没有评论: