【问题标题】:Zend Framework GET parameter still there after change pageZend Framework GET 参数在更改页面后仍然存在
【发布时间】:2011-12-01 11:32:39
【问题描述】:

我不知道 Zend 框架的行为是否正常或有什么问题...

例如...如果我点击这样的链接:

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

因此 URL(它将重定向到的位置)将是:www.mydomain.com/SubCategory/index/Category__ID/4

是否正确...

但现在我在这个 URL 的页面中:www.mydomain.com/SubCategory/index/Category__ID/4

我点击这样的链接:

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

它将转到 URL:www.mydomain.com/Index/index/Category__ID/4

但是为什么呢?

不应该只是:www.mydomain.com/Index/index ????

为什么他还有GET参数?

这是正常行为还是我的应用程序有问题?如果出了什么问题,可能是什么?

再次感谢...

萨缪尔

【问题讨论】:

标签: zend-framework url redirect parameters get


【解决方案1】:

答案很简单。在带有url参数的数组后面写:NULL, TRUE like that

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

True 表示 url 是绝对的而不是相对的。

【讨论】:

    猜你喜欢
    • 2023-01-31
    • 2021-09-08
    • 2020-07-01
    • 2018-08-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多