【发布时间】:2014-03-29 15:04:19
【问题描述】:
所以在花了很多时间弄清楚站点根之后,我决定问这个问题
我的网站有以下目录结构:
includes //(contains db and other includes files)
public_html //(this is the web -appication)
我想要的是包含这两个文件夹的目录的路径,而不是这些文件夹中的路径。
所以在包含目录中我有一个名为 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_html 文件夹并将其用于其他路径好吧
我该怎么做?
请以这种方式提及它是获取站点根目录的“正确”方式。如果没有提到正确的方法。
【问题讨论】:
标签: php path directory-structure document-root