Welcome Guest, Not a member yet? Register   Sign In
How to use $request->uri->getSegment() inside view?

(This post was last modified: 06-20-2020, 11:20 PM by wdeda.)

(06-20-2020, 11:02 AM)0x0undefined Wrote: I'm trying to use `$ request-> uri-> getSegment (1)` in the view but I get an error saying "Undefined variable: request", what should I do to display a given segment in the view?

I use this, in Model:
PHP Code:
$request = \Config\Services::request();
        $uri $request->uri;
        $id $uri->getSegment(3); 

Messages In This Thread
RE: How to use $request->uri->getSegment() inside view? - by wdeda - 06-20-2020, 11:20 PM

Theme © iAndrew 2016 - Forum software by © MyBB