CodeIgniter Forums
Command line usage and passing arguments with slashes - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Command line usage and passing arguments with slashes (/thread-45617.html)



Command line usage and passing arguments with slashes - El Forum - 09-28-2011

[eluser]Unknown[/eluser]
I am trying to use code igniter on the command line. I am using it as follows:

php index.php controller_name function_name /path/to/file/file.txt

However codeigniter does not pass the entire argument, it splits it using the slash into an array and passes that instead.

Is there any way to get codeigniter to not do this? I really don't want to have to urlencode my file path when using CLI. Also I don't want to implode the array it passes to construct the file path.


Command line usage and passing arguments with slashes - El Forum - 06-09-2012

[eluser]Unknown[/eluser]
I have the same problem with v2.1.0 - has anyone resolved this issue yet?


Command line usage and passing arguments with slashes - El Forum - 07-25-2012

[eluser]Unknown[/eluser]
Hello Guys,

there are basically two approaches:

1. Use $GLOBALS["argv"]
2. Extract the path from $this->uri->uri_string()

Not elegant, but it works.

Hope it helps a little Smile

best regards
-André