Thinkphp5笔记八:路由别名Route
主要作用:隐藏自己的真实路由名称
application/Route.php
使用方法一:
<?php use think\Route; Route::alias('home','index/index'); Route::alias('admin','admin/index');
方法二:
<?php return [ '__pattern__' => [ 'name' => '\w+', ], '[hello]' => [ ':id' => ['index/hello', ['method' => 'get'], ['id' => '\d+']], ':name' => ['index/hello', ['method' => 'post']], ], '__alias__' => [ 'home' => 'index/index', 'admin'=> 'admin/index' ], ]; 复制代码