Reputation: 975
I'm trying to capture slashes from a url and pass them into my controller. Here's an example of my problem:
Let's say I GET http://localhost/here/is/an/example
where my route looks like:
$routes['here/is/(:any)'] = 'my_controller/$1';
and I have the following function definition in my_controller
:
public function index($rest_of_the_path) {
...
}
I would like the value of $rest_of_the_path
to be 'an/example'
, but it actually equals 'an'
. How can I structure my code so I get what I want?
P.S.: I'm using Codeigniter 2.1.3
Upvotes: 1
Views: 1351
Reputation: 3259
You can simply do this:
public function index() {
$rest_of_the_path = implode("/", func_get_args());
...
}
Upvotes: 2