Opening file php -


supposing have file called "utils.php" open file writing or reading:

$myfile="myfile.txt"; $fileout=fopen($myfile,'w') or die("not opened"); 

now if have script under directory, "mydir/myscript.php" , include "utils.php" in "myscript.php", where file (try to) opened from? path of "utils.php" or path of "myscript.php". , if "myscript.php"'s directory, means each script includes "utils.php" search file called "myfile.txt" in directory, doesn't it?

paths assumed relative directory of script running command, unless absolute path specified (by prefixing path '/'), if script being called somewhere else. if specified include in say, "/var/www/localhost/htdocs/foo.php", include statement in same folder, within included file fopen statements within whichever folder php file in (unless otherwise specified).


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -