ThinkPHP5 Route 訪問原地址非法請求

這是我配置的路由

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中默認模塊名爲你路由的模塊名 

路由設置,這樣就可以同時使用了。

原理的話沒有具體查找過。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章