Yii2的路由规则如何定位

新手提问 · ppker · 于 6年前 发布 · 4970 次阅读
 'topic/<id:[0-9a-zA-Z\-]+>' => 'topic/default/view',

这个竟然定位到 modules/topic/controllers 里面了 这是为什么呢? 我一直以为 只是定位 controllers目录里面的 竟然还可以定位到modules 求帮我解释下哈 谢谢了

共收到 3 条回复
forecho#16年前 1 个赞

当然是可以定位到 modules 里面去的,不然 modules 里面的控制器怎么访问?

是根据 topic/default/view 这个参数的位数来判断的,具体你可以看 UrlRule 实现方法。

2楼 已删除.
ppker#36年前 0 个赞

@forecho #1楼 666 谢谢群主大大

Thanku for sharing this useful information.. I would like to share something too...
Thinkwik is an expertise driven web and mobile apps Development Company helping businesses achieve their goal through robust and engaging web and mobile presence. To Build real time application, mobile app and website

Node Js Development Company

Android App Development

iOS App Development

添加回复 (需要登录)
需要 登录 后方可回复, 如果你还没有账号请点击这里 注册