When you include a file with include or Requice, the file path is preceded by DirName (__file__). For example: Existing a.php, b.php, c.php, D.PHP4 files, their relationship is:
B.php (same level as root directory)
Root directory/a.php
Root directory/c.php
Root directory/dir/d.php
Now a.php to include b.php, c.php. The wording is as follows:
Include_once (DirName (__file__). " /.. /b.php "); Include_once (DirName (__file__). " /c.php "); ?> |
If you want to include d.php in c.php. The wording is as follows:
Include_once (DirName (__file__). " /dir/d.php "); ?> |
This approach is currently the most effective way to solve the problem of path dislocation.
http://www.bkjia.com/PHPjc/371453.html www.bkjia.com true http://www.bkjia.com/PHPjc/371453.html techarticle when you include a file with include or Requice, the file path is preceded by DirName (__file__). For example: Existing a.php, b.php, c.php, D.PHP4 files, their relationship is: b.php (same as root directory ...)