• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
controller action run external php file

#1
[eluser]dimis[/eluser]
I want when a action of a controller finish , this action to run a file at the root of my application.How can I do this?
Dimis

#2
[eluser]Dam1an[/eluser]
If you want this to happen at the end of every request, you could use a post system hook, or if using PHP5, you could put a __destruct function in MY_Controller

You can just execute the function by including it (if it's written as a class, you will need to add some code to instantiate the class)

You can use the APPPATH constant to build the include path

#3
[eluser]dimis[/eluser]
Maybe I were not clean.
I have a file (torun.php for example) at the root of my site that it is a clean php file and it has nothing related with codeigniter application (it is a cron file that runs independent from Codeigniter).
And I want this file to run within an action of a controller (omly one).
CI can not run a simple php file ?I have to "include" this file?How?

#4
[eluser]Dam1an[/eluser]
You literalyl just answered your question
Code:
include APPPATH.'torun.php';

Just put that at whatever point you want it to be called, and it will go off and run that, and when it finishes, return to that point in the controller and carry on


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.