Route with variable gives 404 |
Hi all,
I'm new to CodeIgniter and have a routing issue. What I try to do is add a variable to the URL to pass it into the method arguments. I used this example from the CI manual: PHP Code: $routes->add('product/(:num)', 'Catalog::productLookupByID/$1'); The actual code to match my needs is: PHP Code: $routes->get('/backend/profile/', 'backend/Profile::index'); The method in the controller is: PHP Code: public function index($var = null): void When I run the URL http://localhost:8080/backend/profile/1 I expect it to echo "1". But instead a 404 is thrown [Controller or its method is not found: \App\Controllers\backend::index] This controller does exist, because when I remove the 1 from the URL, the page loads, however, it is echoing NULL obviously... What is this beginner missing here??? |
Messages In This Thread |
Route with variable gives 404 - by sjender - 12-11-2020, 07:50 AM
RE: Route with variable gives 404 - by neoneeco - 12-12-2020, 02:53 AM
RE: Route with variable gives 404 - by sjender - 12-14-2020, 03:38 AM
RE: Route with variable gives 404 - by ReivaxBird - 12-14-2020, 08:25 AM
RE: Route with variable gives 404 - by paulbalandan - 12-17-2020, 08:57 AM
RE: Route with variable gives 404 - by includebeer - 12-21-2020, 07:16 AM
RE: Route with variable gives 404 - by John_Betong - 12-17-2020, 08:13 PM
|