note 29358 added to function.include
| From: | Cerium at x2productions dot net | Date: | Tue, 11 Feb 2003 08:15:13 +0000 |
| Subject: | note 29358 added to function.include | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-43772@lists.php.net to get a copy of this message | ||
One odd thing I found using include/require, was how it reads files from each file. In my particular
case, I was calling functions from an included file, which read data from files. The base file also
had a few functions which included file access.
The problem I ran into, was whenever I called a function from include.php that accessed a file,
subsequent calls that involved reading that -same- file, that went called from the include.php,
would fail.
# base.php
include(include.php);
fopen(test.txt); # works
fclose;
opentextfile(test.txt); # works
fopen(test.txt); #fails
fclose;
---------------------------
# include.php
function opentextfile($filename)
{
fopen(test.txt);
fclose();
}
I am somewhat new to PHP, but as far as I can tell, this isn't normal. if anyone figures out
what I'm doing wrong, please contact me.
--
http://www.php.net/manual/en/function.include.php
http://master.php.net/manage/user-notes.php?action=edit+29358
http://master.php.net/manage/user-notes.php?action=delete+29358
http://master.php.net/manage/user-notes.php?action=reject+29358