## :-: 后臺路由
$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');
}
}
~~~