I have these urls:
How to get controller name, action name from these urls. I’m codeigniter newbie. Are there any helper function to get this info.
You could use the URI Class:
$this->uri->segment(n); // n=1 for controller, n=2 for method, etc
There is an optional second parameter that permits you to set your own default value if the segment is missing. For example, we could use
$controllerName = $this->uri->segment(1, 'magazine');
I’ve also been told that the following work, but am currently unable to test: