Set up common Files to include: (Under Project root)
include.php
<?php Header ("Content-type:text/html;charset=utf-8"); Date_default_timezone_get ("PRC"); Session_Start (); _file_ returns the full (absolute) path of the file where the current code resides (rather than the URL) //dirname ($file _name) returns the $file_name layer directory name define ("ROOT", DirName ( FILE)); Set_include_path ("."). Path_separator. ROOT. " /core ". Path_separator. ROOT. " /configs ". Path_separator.get_include_path ()); Require_once ' mysql.func.php '; Require_once ' image.func.php '; Require_once ' common.func.php '; Require_once ' string.func.php '; Require_once ' page.func.php '; Require_once ' configs.php '; Require_once ' admin.inc.php '; Require_once ' cate.inc.php '; Require_once ' pro.inc.php '; Require_once ' album.inc.php '; Require_once ' user.inc.php '; Require_once ' upload.func.php '; Connect ();? >
Then, the other pages directly require_once ('./include.php ')//path relative to include.php
However, there is a problem with file nesting
Here is a detailed explanation of the specific
Click to open link
So, for the sake of insurance, it's best
Require_once (DirName (FILE). ' /'.'.. /include.php ');
and start with DirName (FILE). ' /'