So, here's my situation :
- I have a complete app set up with CodeIgniter.
- I'm initiating a background task, running a PHP script.
My question :
- How could I use CodeIgniter function (e.g.
$this->db
or$CI->db
- doesn't matter) from that external PHP script?
Idea : Could a workaround, like include 'index.php';
at the top of the script do the trick?
In recent Codeigniter versions you can run standard controller actions from command line. If your task is some kind of a daemon you can embed the "task trigger" logic in a long running part of your script and shell out for the actual work to CI land.