Magento 2 routes.xml 用法解析
本文内容来自QQ群大佬陈伟明(一叶知秋)的学习分享
标准路由格式:
/ / / /
- specifies the base URL for the Magento instance - specifies the store context - specifies the frontName of the FrontController to use (for example, [routesxml]) - specifies the name of the controller - specifies the action class to execute on the controller class
定义routes.xml
- /etc/routes.xml
- /etc/frontend/routes.xml
- /etc/adminhtml/routes.xml
%routerId%:
前端frontend有 robots urlrewrite standard cms default
后端adminhtml 有 admin default
%routeId%:路由标识
%frontName% 指明URL请求的名字
%moduleName% 在哪个模块
before 不是必须的,它是可以重写一个控制器
若 HelloWorld 下面 Controller/Account/Login.php
这样就重写的 系统的客户Login 的方法
