Equivalent to "uri rsegment"? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=31) +--- Thread: Equivalent to "uri rsegment"? (/showthread.php?tid=74915) |
Equivalent to "uri rsegment"? - RedskyThirty - 11-25-2019 Hello, I would like to know if there is an equivalent to "$this->uri->rsegment()" in CI4? I'm searching in the doc but I don't find anything about that. I tried "$this->request->uri->getSegments()" in my default routed controller but I get an array with two empty strings. My default route: $routes->get('/', 'Corporate/Landing::index'); GetSegments output: ["",""] RE: Equivalent to "uri rsegment"? - XTAZ - 11-25-2019 (11-25-2019, 02:56 AM)RedskyThirty Wrote: Здравствуйте,What did you want to get if uri is "/"? If you open "/corporate/landing" in example, getSegments() returns ['', 'corpotate', 'landing']. CI4 doesn't have getRSegment method, only getSegment() and getSegments() You can view all methods in file /system/HTTP/URI.php RE: Equivalent to "uri rsegment"? - RedskyThirty - 11-25-2019 (11-25-2019, 02:43 PM)XTAZ Wrote:(11-25-2019, 02:56 AM)RedskyThirty Wrote: Здравствуйте,What did you want to get if uri is "/"? If you open "/corporate/landing" in example, getSegments() returns ['', 'corpotate', 'landing']. Yes, I would like to get ['corporate', 'landing', 'index']. It was really helpful in CI3. There is no equivalent for the moment? Or a way to do that? |