Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CodeIgniter : Run a script from command line if the controller is inside a folder?

As stated here : http://codeigniter.com/user_guide/general/cli.html

A page like : http://www.example.com/myController/myFunc/myParam

can be run on the command line as :

php index.php myController myFunc myParam

My codeignitor set up has some folders to group the controllers, lets say like this :

myFolder -> myPageController
         -> myAdminController

So, the url becomes :

http://www.example.com/myFolder/myController/myFunc/myParam

How do I call the same thing on CLI ? Something like :

php index.php "myFolder/myController" myFunc myParam

Does not seem to work.

like image 293
DhruvPathak Avatar asked Dec 03 '22 05:12

DhruvPathak


2 Answers

You can try with :

php index.php myFolder myController myFunc myParam1 myParam2 ...
like image 89
mlinuxgada Avatar answered Jan 10 '23 04:01

mlinuxgada


Note, the index method in class file is necessary for work properly in CLI, otherwise codeigniter will return 404 error.

;)

like image 24
aaronroman Avatar answered Jan 10 '23 03:01

aaronroman