一、tp5的url路径格式
http://主机名/入口文件/模块/控制器/controller/操作(方法)/参数
如:
文件结构如下:
对应的访问域名:
http://localhost/flavioy/public/index.php/sample/test/hello
二、URL路径简化
1、编写目录
application文件夹下的route.php
2、调用方法:动态注册
//使用Route类
use think\Route;
//调用rule方法
Route::rule('hello','sample/Test/hello');
//将后缀sample/Test/hello简化为hello
//完整参数
Route::rule('路由表达式','路由地址','请求类型','路由参数(数组)','标量规则');
域名由http://localhost/flavioy/public/index.php/sample/test/hello
简化为http://localhost/flavioy/public/index.php/hello