【问题标题】:how to route all sub requests to one action in yii2 framework如何将所有子请求路由到 yii2 框架中的一个操作
【发布时间】:2021-05-31 11:58:52
【问题描述】:

我想在一个动作中捕获所有网址,例如:

* http://my-domain.com/controller/myaction/test
* http://my-domain.com/controller/myaction/test2
* http://my-domain.com/controller/myaction/other_url

我可以在“myaction”上获得它吗?

【问题讨论】:

    标签: php routes yii yii2 action


    【解决方案1】:

    试试这样的东西

    '<controller:[\w\-]+>/<action:[\w\-]+>/<ident:\d+>/<token:\w+>/<module:\w+>' => '<controller>/<action>' // 2
    

    上面将采用/创建类似的网址

    localhost/frontend/web/site/test-router/10/ADB/P120
    

    【讨论】:

    • @ShaxzodShukrulloyev。请您投票支持我的答案,以便对我的个人资料有所帮助,我会继续在堆栈中添加答案
    猜你喜欢
    • 2013-06-09
    • 1970-01-01
    • 2012-04-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-07-16
    相关资源
    最近更新 更多