這是我配置的路由
use think\Route;
Route::get('/',function(){return 'Hello World';
});
Route::get([
'news/:id/:name'=>'api/News/read',
]);
訪問路由地址 http://localhost/shopapi/news/3/1
訪問原地址 http://localhost/shopapi/api/news/read/id/3/name/1
在ThinkPHP5路由中有說明
如果想要原地址和路由地址可以同時訪問,設置config中默認模塊名爲你路由的模塊名
路由設置,這樣就可以同時使用了。
原理的話沒有具體查找過。