PHP访问路径


PHP access path

我在httpd.conf中将"htdocs"配置为localhost/Workspace/。当我转到url localhost/index.php时,一切都正常,但当我尝试连接到localhost/''members/register时,我会遇到以下问题。

警告:require_one(core/init.php):无法打开流:第2行C:''examplep''htdocs''Workspace_members''register.php中没有这样的文件或目录致命错误:requireonce():在第2行的C:''examplep''htdocs''Workspace_members''register.php中打开所需的'core/init.php'(include_path='.;C:''examplep''php''PEAR')失败

当我从"Workspace/''umembers"中删除文件并将其移动到"Workspace"目录时,一切都正常。你可以在这里看到我的代码。

如果你有任何建议,请帮助我。:)

index.php上,您可以尝试一下:

<?php
$rootpath =  dirname(__FILE__);
set_include_path(get_include_path() . PATH_SEPARATOR . $rootpath);
include 'header.php';
include 'footer.php';

此外:将core/Init.php重命名为core/Init.php
没有任何函数/functions.php(参考core/init.php第26行);

您的'core'目录是'_members'目录之上的一个目录。尝试require_once('../core/init.php')