I need to call a script from a controller function, but I am not sure what my current directory is.
The script is located in a assets folder which is on the same level as codeigniters application folder. I can call it using
require base_url().’/assets/php/script.php’;
but I’d rather not use that since it is using http.
If you are using PHP 5.3 you could use the
__DIR__constant which gives you the absolute path to the PHP file you are in. If__DIR__is not available you could usedirname(__FILE__)instead. See http://php.net/manual/en/language.constants.predefined.php