简体   繁体   English

路线laravel中的正则表达式?

[英]Regex in route laravel?

Error in my route (404)我的路线错误 (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:并处理函数中的 GET 参数

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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