2017-06-13 17:22:59 1849次浏览 2条回答 0 悬赏 40 金钱

如果希望所有带 to 参数的地址都解析到同一个地址下,这个规则怎么设置?比如

user/index?to=article/index/1

这个 to 的值意义上和 r=article/index/1 相同,user/index 指代任意一个地址

最好在解析之后的地址,比如这里是 article/index/1,在这个地址上带上参数 from=user/index

这个有办法实现么?

最佳答案

  • cola 发布于 2017-06-14 09:22 举报

    你这个解析我觉得最好放在web服务上去配置,比如Nginx或者Apache

  • 回答于 2017-06-14 10:12 举报

    'urlManager' => [

            'class' => 'yii\web\UrlManager',
            'enablePrettyUrl' => true,
            'showScriptName' => false,
    

    // 'enableStrictParsing' => true,

            'rules' => [
                'suppliers' => 'supplier-profile/index',
                'administrator' => 'supplier-profile/index',
                'franchisee' => 'supplier-profile/index',
                'order' => 'inquiry-record/index',
                'orders' => 'inquiry-record/index',
            ],
        ],
    

    在配置文件中应该可以实现吧

    5 条回复
    回复于 2017-06-14 17:07 回复

    可以,哈哈

    回复于 2017-06-14 18:54 回复

    666666666666

    回复于 2017-06-15 15:05 回复

    苍老师好 头像不错

    回复于 2017-06-15 16:51 回复
    回复于 2017-06-15 18:04 回复

    卧槽

您需要登录后才可以回答。登录 | 立即注册
forsona
职场新人

forsona

注册时间:2016-03-12
最后登录:2018-12-26
在线时长:6小时32分
  • 粉丝0
  • 金钱15
  • 威望0
  • 积分75

热门问题