CodeIgniter Forums
How can I check the uri segment? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forum-28.html)
+--- Forum: CodeIgniter 4 Discussion (https://forum.codeigniter.com/forum-31.html)
+--- Thread: How can I check the uri segment? (/thread-72581.html)



How can I check the uri segment? - ramstudio - 01-08-2019

How can I check the uri segment?
In Ci3, it was possible to check

Code:
$this->uri->segment(2);



RE: How can I check the uri segment? - ciadmin - 01-08-2019

The "CI4 way" is simialr ... https://codeigniter4.github.io/CodeIgniter4/incoming/incomingrequest.html#the-request-url


RE: How can I check the uri segment? - ramstudio - 01-08-2019

He asked, he answered.
$ uri = current_url (true);
$ class_open = $ uri-> getSegment (2);
Understood.


RE: How can I check the uri segment? - titounnes - 01-08-2019

try this.
$this->request->uri->getSegment(2);


RE: How can I check the uri segment? - Gezerw - 02-22-2019

Most likely, this method will be best $data['current_uri'] = $this->uri->segment(1).
It helped me. Try it, then write.=))