开发者

Zend Framework GET parameter still there after change page

I don't get if is a normal behavior of the Zend Framework or something is开发者_如何转开发 wrong...

For example... If I click to a link like this:

        <a href="<?= $this->url(array(
                                 'controller' => 'SubCategory',
                                 'action' => 'index',
                                 'Category__ID' => 4)); ?>">
        </a>

So the URL ( where it will redirect ) will be: www.mydomain.com/SubCategory/index/Category__ID/4

Does correct...

But now that I'm in the page with this URL: www.mydomain.com/SubCategory/index/Category__ID/4

I click a link like that:

<a href="<?= $this->url(array(
                         'controller' => 'Index',
                         'action' => 'index')); ?>">Home</a>

It will go to the URL: www.mydomain.com/Index/index/Category__ID/4

But why?

Should not be just: www.mydomain.com/Index/index ????

Why he still have the GET parameter?

Is it a normal behavior or something is wrong in my application? And if something is wrong, what can be?

Thanks again...

Samuele


The answer is simple. After the array with the parameter of the url write this: NULL, TRUE like that

$this->url(array(...), NULL, TRUE);

The True means that the url will be absolute and not relative.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜