本地服务器和在线服务器上的php站点根基础知识
所以在花了很多时间弄清楚站点根之后,我决定问这个问题 我的站点具有以下目录结构:本地服务器和在线服务器上的php站点根基础知识,php,path,directory-structure,document-root,Php,Path,Directory Structure,Document Root,所以在花了很多时间弄清楚站点根之后,我决定问这个问题 我的站点具有以下目录结构: includes //(contains db and other includes files) public_html //(this is the web -appication) 我想要的是包含这两个文件夹的目录的路径,而不是这些文件夹中的路径 因此在includes目录中有一个名为initialize.php的文件: defined('SITE_ROOT') ? null : define(
includes //(contains db and other includes files)
public_html //(this is the web -appication)
我想要的是包含这两个文件夹的目录的路径,而不是这些文件夹中的路径
因此在includes目录中有一个名为initialize.php的文件:
defined('SITE_ROOT') ? null : define('SITE_ROOT',dirname(__FILE__));
这将在wamp上提供以下输出:
C:\wamp\www\Mysite\includes\
在服务器上,我得到:
/home/a4554444/includes
我想要的是:
C:\wamp\www\MySite\
我想删除最后列出的\includes文件夹,以便我可以使用该路径访问public\u html文件夹,并在其他路径上使用它
我该怎么做
也请用这种方式提及它,这是获取站点根目录的“正确”方式。如果没有提到正确的方法。也许您正在寻找类似的方法:
define('serverpath', $_SERVER['DOCUMENT_ROOT']. '/');