🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
## :-: 后台路由 $this->url() - 模块中二次封装了微擎系统的 createMobileUrl和createWebUrl 函数,使用时变的更加简单 ### 说明 ~~~ $this->url(string $string); ~~~ 生成后台url | 用法 | 描述 | | --- | --- | | 不带任何参数 | 当前路由 | | \[模块/\]\[控制器/\]\[操作\] | 常用写法,支持跨模块 | ### 示例: 控制器位于`/inc/web/Index.php`中,请看以下实例: ~~~ // +---------------------------------------------------------------------- // | onegow [ WE CAN DO IT MORE SIMPLE] // +---------------------------------------------------------------------- // | Copyright (c) 2016-2018 http://onegow.com All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- // | Author: mrye 55585190@qq.com // +---------------------------------------------------------------------- namespace inc\web; class Index extends Base { /** * 访问路径:http://wq.mrye.xin/web/index.php?c=site&a=entry&do=index-admin&m=og_test * 下面route()生成的链接会进入到这里 */ public function Admin() { echo 'this is admin controller'; } /** * 跨方法路由 * 访问路径:http://wq.mrye.xin/web/index.php?c=site&a=entry&do=index-route&m=og_test */ public function route() { //此路径会跳转至 Index控制器底下的 admin 方法 echo $this->url('admin'); } /** * 跨控制器路由 * 访问路径:http://wq.mrye.xin/web/index.php?c=site&a=entry&do=index-route2&m=og_test */ public function route2() { //此路径会跳转至 admin控制器底下的 index 方法 echo $this->url('admin/index'); } /** * 跨模块路由 * 访问路径:http://wq.mrye.xin/web/index.php?c=site&a=entry&do=indexr-oute3&m=og_test */ public function route3() { //此路径会跳转至 mobile模块index控制器底下的 home 方法 echo $this->url('mobile/index/home'); } } ~~~