解决php include中绝对路径与相对路径的问题
在使用php的include/require/include_once/require_once时有时会碰到路径困扰,尤其是重复包含或嵌套包含时,一个有效的办法是定义文件“根”,如:
if (!defined('KEIYICLASS_ROOT')) { define('KEIYICLASS_ROOT', dirname(__FILE__) . '/'); } // core classes include_once(KEIYICLASS_ROOT."core/date.php"); include_once(KEIYICLASS_ROOT."core/db.php"); include_once(KEIYICLASS_ROOT."core/init.php"); include_once(KEIYICLASS_ROOT."core/sys.php");