简体   繁体   中英

.php in a routes path for Laravel 5.5

I am migrating a site from a vanilla PHP site to Laravel. Is there a way to include the old URL paths /products.php?id=1 to match a route in routes.php ?

I want to be able to redirect them to the correct URL, extract the id variable and restructure the URL to match the new routes.

Create a route with .php :

Route::get('products.php', 'ProductController@index');

And use it:

public function index()
{
    $id = request('id');
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM