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
Post a Comment