Welcome Guest, Not a member yet? Register   Sign In
help getting all routes in an array in controller
#2

A quick followup that partially works.  I can do:
PHP Code:
include(APPPATH 'Config\Routes.php');
var_dump($routes->getRoutes());
exit; 

Which is a really bad idea, but $routes->getRoutes() will give me all of the available GET routes.  The docs say that that this Returns the raw array of available routes. (https://codeigniter4.github.io/api/class..._getRoutes) which is partially true.  It seems to only return the routes available to the current http request type.  So if I do GET myController.php it shows me only the GET routes.  If I do POST myController.php it only shows me the POST routes.

$routes->setHTTPVerb('POST'); sounds like it ought to work, but it doesn't.  If I do a GET request and set the verb to POST, I only get an empty array.  
Reply


Messages In This Thread
RE: help getting all routes in an array in controller - by rramsey - 12-12-2022, 09:05 AM



Theme © iAndrew 2016 - Forum software by © MyBB