Reputation: 7385
well, i have a function within a controller called test, and i can access it by going to http://localhost/nwk/control/test
this is my function. I want to use the data given in the next segment from the "test" as a php variable.
so if i put
function test()
{
$var = $this->uri->segment(3);
echo $var;
}
according to the user guide if I enter control/test/data, my variable should be equal to 'data'?
doesn't seem to be working.
Am I missing something here?
Upvotes: 0
Views: 2077
Reputation: 7385
For some reason me autoloading the URI library made this whole functionality not work.
Everything is fine now. Thanks everyone.
Upvotes: 0
Reputation: 4043
You could simply make like this:
function test($var, $another_var)
{
echo $var.' '.$another_var;
}
And opening http://localhost/nwk/control/test/it/works would echo "it works"
Upvotes: 1
Reputation: 86406
You are missing the assignment operator
function test() { $var = $this->uri->segment(3); echo $var; }
Upvotes: 1