Today with PHP to write a simple Android login server code, encountered a particularly depressing thing, using require_once () introduced to the PHP file in the file error message, the file is not found.
PHP require_once () is mainly used to introduce a PHP file into another php file, I first talk about the problems I encountered, my directory structure is this:
That's what I wrote in user.class.php :
Require_once (".. /config/mysqlconfig.php "); require_once ('.. /util/handlemysql.class.php ');
It looks really good, but I've introduced user.class.php in the index.php .
Require_once ("class/user.class.php");
The code looks good, however, the following error is reported in the run:
Think about it and finally found the problem:
The require_once () function actually puts the code of the file you include in the location you refer to, that is, after the above two references, in fact, in the index.php file now.
Require_once (".. /config/mysqlconfig.php "); require_once ('.. /util/handlemysql.class.php ');
Then index.php and follow this path to find the two files, nature will not find.
It seems that the relative path should be used cautiously in the actual development.