You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey,
I'm trying to add a route to my website with tools?p=K94rF pattern and not /tools/K94rF.
So i've written: $router->get('/tools?p=:p_id', [ToolsController::class, 'actionGetTools'], [ 'require' => [ 'p_id' => '[a-zA-Z0-9_-]{5}', ], 'default' => [ 'p_id' => '', ] ]);
And it is not working, so i tried to change it from ? to /, like this: $router->get('/tools/:p_id', [ToolsController::class, 'actionGetTools'], [ 'require' => [ 'p_id' => '[a-zA-Z0-9_-]{5}', ], 'default' => [ 'p_id' => '', ] ]);
And it works perfect.
I need the routing with ? (the first one), there is any other way to implement it ?
Thank you 😄
The text was updated successfully, but these errors were encountered:
You can do something like $mux->get("/search?:query", ["Controllers\\Index", "actionIndex"]);
And then use raw $_GET in your controller. $query = array_map("some_filtering_function", $_GET);
Hey,
I'm trying to add a route to my website with tools?p=K94rF pattern and not /tools/K94rF.
So i've written:
$router->get('/tools?p=:p_id', [ToolsController::class, 'actionGetTools'], [ 'require' => [ 'p_id' => '[a-zA-Z0-9_-]{5}', ], 'default' => [ 'p_id' => '', ] ]);
And it is not working, so i tried to change it from ? to /, like this:
$router->get('/tools/:p_id', [ToolsController::class, 'actionGetTools'], [ 'require' => [ 'p_id' => '[a-zA-Z0-9_-]{5}', ], 'default' => [ 'p_id' => '', ] ]);
And it works perfect.
I need the routing with ? (the first one), there is any other way to implement it ?
Thank you 😄
The text was updated successfully, but these errors were encountered: