I need to call PHP function within my custom module controller. But the relevant PHP file contain in different folder. How I solve this? `
<?php function doLog($text) {
// open log file
$filename = "form_ipn.log";
$fh = fopen($filename, "a") or die("Could not open log file.");
fwrite($fh, date("d-m-Y, H:i")." - $text\n") or die("Could not write
file!");
fclose($fh);
}
doLog("This is test");
?>
-
Can you please be more specific? Is the code in a PHP class? What kindof classis? Model or Helper?Phoenix128_RiccardoT– Phoenix128_RiccardoT2016年02月26日 12:16:23 +00:00Commented Feb 26, 2016 at 12:16
-
@RiccardoT No this is just a PHP file that containing function to write/append log file. Path for the file magento->testing->test.php. I have updated my question with code.Dis_Pro– Dis_Pro2016年02月27日 03:21:48 +00:00Commented Feb 27, 2016 at 3:21
-
Why on earth are you doing this in the first place? Use the logging functionality provided in magento frameworkProxiBlue– ProxiBlue2016年02月27日 05:33:03 +00:00Commented Feb 27, 2016 at 5:33
1 Answer 1
You can mention URL like $url = 'http://127.0.0.1/magento/testing/curl.php';
or you should get base directory like $media_path = Mage::getBaseDir('media'); or you can redirect to relevant URL.
default