Codeigniter 3 - How to get all routes?

July 13, 2018 | Category : Codeigniter PHP

Hello Developer,

In this tutorial, i will show you how to get all routes list in codeigniter application. Actually, few days ago i was creating one example on codeigniter 3 project. But when i access route from url it show me 404 not found page. i thought error from index.php or something, but tried that way and nothing happen.

Then i plan to get list of all routes and check i created route successfully or not. But i don't know how to get list of all routes in codeigniter. So finally i search on google and find out solution, so in this example, you can also get all routes. Just copy below code and put in your codeigniter app.

Get All Routes:

$routes = $this->router->routes;

print_r($routes);

I hope you got solution.....