我搜索的方法来做到它,所以它会工作,但没有人似乎对所有路径的工作,所以我在想,如果你可以给我如何做到这一点的方向:相对/绝对路径问题
这是结构:
Home Directoy
config.php
index.php
includes/
user_login.php
applicant_track.php
ucp/
index.php
当我试图包括包括/ user_login.php在UCP/index.php中它不会让我,并说,它无法找到该文件,我的代码是在ucp/index.php中是:
if(!defined('root_path'))
{
define('root_path', realpath(dirname(__FILE__)));
}
include(root_path . '\config.php');
switch($_GET["a"])
{
case null: include(root_path . '\index.php'); break;
case "login": include(root_path . '\includes\user_login.php'); break;
}
这就是我得到的:
Warning: include(E:\xampp\htdocs\aod_panel\ucp\config.php): failed to open stream:
我很乐意为如何解决这个问题提供建议。
告诉我实际路径config.php所在的位置。 –
您是否尝试过:'包括$ _ SERVER [ 'DOCUMENT_ROOT'] '/包括/ user_login.php';' – SuperDJ
你的index.php代码是在\ UCP,所以root_path是\ UCP,但config.php文件不在\。 ucp ... – Armage