说到tp6最近自己新写了一个博客,然后用到的就是tp6框架,然后发现与之上一版本tp5 有很多不同,比如路由注册,tp6默认单应用不会有什么问题,但是多应用的时候很多人就懵逼了。下面我直接贴给大家tp6多应用路由怎么去配置吧。 首先需要在应用的目录下新建一个route目录在目录新建app.php如下:
<?php // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- // | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- // | Author: liu21st <liu21st@gmail.com> // +---------------------------------------------------------------------- namespace app\index\route; use think\facade\Route; // index.localhost.com Route::get('/', 'index/index/index'); //如果是资源路由 // index.localhost.com/test test=>对应test controller资源路由不用指定方法,这里不明白自己百度在这里不多做解释 Route::resource('/test', 'index/test');详情演示查看 七天下博客