route - laravel routing, can pathinfo mode be implemented?
ringa_lee
ringa_lee 2017-05-16 16:53:05
0
1
832

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?

ringa_lee
ringa_lee

ringa_lee

reply all(1)
Ty80
// url: http://sf.gg/1/category/list?cate_id=12
 $path = Request::path();// /1/category/list
 $path = explode('/',$path,3)[2];// category/list
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template