Forum Moderators: coopster
I have a text file stored above the document root. The script defines a variable like this:
$data_file = '../../data.txt';
When I call the script from another page somewhere else from within the website structure of course the relative filename for the data file is wrong.
All I can think of is to get the directory I'm currently in using dirname($_SERVER['PHP_SELF']) and strip off two layers using regular expressions. But isn't there a simpler way? Thanks.