Tried URI::uri_string()
but can't get it to work with the base_url.
URL: http://localhost/dropbox/derrek/shopredux/ahahaha/hihihi
Returns: dropbox/derrek/shopredux/ahahaha/hihihi
but http://localhost/dropbox/derrek/shopredux/
just returns an empty string.
I want the first call to return "ahahaha/hihihi" and the second to return "". Is there such a function?
I don't know if there is such a function, but with $this->uri->uri_to_assoc() you get an associative array from the $_GET parameters. With this, and the controller you are in, you know how the URL looks like. In you above URL this would mean you would be in the controller dropbox and the array would be something like this:
With this you should be able to make such a function on your own.
In CI v3, you can try:
This will drop the number of URL segments specified by the
$start
argument. If your URL ishttp://localhost/dropbox/derrek/shopredux/ahahaha/hihihi
, then:Try to use "uri" segments like:
form your first URL...You get '' from second URl also for segment(5),segment(6) also because they are empty.
Every segment function counts starts form localhost as '1' and symultaneous segments
Running Latest Code Igniter 3.10
For the parameter or without parameter URLs Use this :
Method 1:
Method 2:
Method 3: