我在包含一个包含文件的文件时遇到问题。
core.inc.php 路径:
www/test/includes/core.inc.php
core.inc.php 中包含的文件:
include_once ('../../connectdb.php');
connectdb.php 路径:
www/connectdb.php
index.php 路径:
www/test/index.php
index.php 中包含的文件:
include_once ('included/core.inc.php');
当我运行 index.php 时,会弹出以下警告:
(!) Warning: include_once(../../connectdb.php): failed to open stream:
No such file or directory in G:\wamp\www\test\includes\core.inc.php on line 7
(!) Warning: include_once(): Failed opening '../../connectdb.php' for
inclusion (include_path='.;C:\php\pear') in G:\wamp\www\test\includes\core.inc.php on line 7
为了动态地更改包含的路径,最佳实践是什么?请帮我解决我的问题。谢谢你。