这是我配置的路由
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中默认模块名为你路由的模块名
路由设置,这样就可以同时使用了。
原理的话没有具体查找过。