简体   繁体   中英

Regex in route laravel?

Error in my route (404)

my route

Route::get('tg/{tg}', 'PP\PayPalController@getHooks');

but return contains ?

https://mydoamin/tg/?code=TG-53125542=id=523651

How to disconsider ? using regex on route

Route::get('tg/{tg}', 'PP\PayPalController@getHooks')->where('tg', regex);

Just do:

Route::get('tg', 'PP\PayPalController@getHooks');

and handle the GET parameter in the function:

public function getHooks(Request $request) {
    $tg = $request->query('tg');
    // do something with it now
}

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