Why does uri->segment(); not work with me? |
[eluser]sungamer[/eluser]
Hello, I am new in developing PHP with CI. Now I have a little problem with $this->uri->segment(3);. I enter this in my adressline Quote:http://127.0.0.1/index.php/Media/index/1Now I tried to extract the "1" from the URI with the given function. But it don't return anything... Could you help me? Thanks!
[eluser]GSV Sleeper Service[/eluser]
that capital M in Media may be causing problems...
[eluser]sungamer[/eluser]
I think there is nothing interesting: Code: <?php
[eluser]metaltapimenye[/eluser]
try to reduce the "n" part of $this->uri->segment(n); try to replace it to '2'.. or '1', ooorr... try to print_r($this->uri->segment());
[eluser]sungamer[/eluser]
I've tried this but it doesn't work. Code: print_r($this->uri->segment(1));
[eluser]xwero[/eluser]
why are you trying to use the media controller if you want the test controller? Or did you route the media segment to the test controller? If you would do Quote:http://127.0.0.1/index.php/test/index/1You should see the desired result
[eluser]sungamer[/eluser]
I used the http://127.0.0.1/index.php/test/index/1 URL, of course. I didn't want to change my media class, so I created the test class.
[eluser]xwero[/eluser]
What do you get if you print $this->uri->segment_array()
[eluser]sungamer[/eluser]
Code: $uri=$this->uri->segment_array(); If I try something like "echo $uri[0]", I get an error. |
Welcome Guest, Not a member yet? Register Sign In |