Target url: index.php/1/category/list? cate_id=12
Achieve the goal: after the number 1, the part before the question mark (i.e. category/list) is obtained as a parameter
Route::get('/{id}/*',function($id, $path){
//
}
The above code does not work, just understand the meaning.
The key to the problem is that the path part is of variable length, it may be first/second, or first/second/third.
How should routing be written?
PHP中文网2017-05-16 16:55:05
// url: http://sf.gg/1/category/list?cate_id=12
$path = Request::path();// /1/category/list
$path = explode('/',$path,3)[2];// category/list