Hi,
I don't know if anyone has run into similar problems, but it seems like
when I use `require_once(. ..)' with files that contain functions I get
an error indicating that it can't redeclare the functions. I thought
the point of the once directive was to PREVENT the system from
including duplicate files (and thus attempting to redeclare the
functions).
It has worked elsewhere, for instance I have a database.php file, that
just wraps the mysql database query functions into my own functions. I
have used it in the following manner in two files one that calls
another:
require_once "./directory/database.php";
And it works fine, it doesn't give me any errors about redeclaring
functions.
Now when I do the following in one file:
require_once "./directory/database.php";
and the following in the file the first calls
require_once $DOCUMENT_ROOT . "/directory/database.php";
I get the redeclare error. Is this because the system is perceiving
these as two seperate files? Syntax wise the above two work exactly
the same as if I had parantheses (I thought this might be the cause of
the error) but it wasn't. Any help/insight on this would be greatly
appreciated.
I don't know if anyone has run into similar problems, but it seems like
when I use `require_once(. ..)' with files that contain functions I get
an error indicating that it can't redeclare the functions. I thought
the point of the once directive was to PREVENT the system from
including duplicate files (and thus attempting to redeclare the
functions).
It has worked elsewhere, for instance I have a database.php file, that
just wraps the mysql database query functions into my own functions. I
have used it in the following manner in two files one that calls
another:
require_once "./directory/database.php";
And it works fine, it doesn't give me any errors about redeclaring
functions.
Now when I do the following in one file:
require_once "./directory/database.php";
and the following in the file the first calls
require_once $DOCUMENT_ROOT . "/directory/database.php";
I get the redeclare error. Is this because the system is perceiving
these as two seperate files? Syntax wise the above two work exactly
the same as if I had parantheses (I thought this might be the cause of
the error) but it wasn't. Any help/insight on this would be greatly
appreciated.
Comment