Welcome Guest, Not a member yet? Register   Sign In
Bug in routes with path in controller
#8

TRY : Backend/Users to Backend\Users
[/quote]

I also have this issue and worked out that changing / to \ works.

The line of code that doesn't play well with the "controllers in folders" is in vendor\codeigniter4\framework\system\Router\Router.php  (:660)

Code:
list($controller, $method) = array_pad(explode('::', $segments[0]), 2, null);

So...

This works
Code:
$routes->get('about', 'Front/Main::about');
This doesn't
Code:
$routes->get('products/(children|men|women)', 'Front/Main::getProducts/$1');
This does
Code:
$routes->get('products/(children|men|women)', 'Front\Main::getProducts/$1');

I'm quite happy to use / but I would like to know if I may get bitten further down the road?  Cool
Reply


Messages In This Thread
Bug in routes with path in controller - by acy29 - 11-22-2019, 05:44 AM
RE: Bug in routes with path in controller - by paulkd - 05-13-2021, 06:28 AM



Theme © iAndrew 2016 - Forum software by © MyBB