PHP网站基础目录结构

时间:2014-03-23 11:55:29

标签: php html directory structure

我有一个时事通讯第三方系统。它一直很好用但是我遇到了一个我希望这是一个非常容易解决的问题。

所以这是我网站的根结构

FTP SERVER
/index.php
/news.php
/shane/shane_about.php
/mailist/globals.php
/mailist/mailbar.php
/mailist/mailbar8.php

所以我有一个输入框,可以让我注册一个时事通讯。它对index.php和news.php起作用,但是在shane_about.php中搞砸了整个页面,因为它在子目录shane中。

现在问题在于globals.php

<?php 
$main_dir = "maillist/";
$website = "http://www.mysite.com/";
$relative_string="index.php?page=mail&";
$absolute_path="/hostingcompanyserver/something/something/something.com/maillist/";
$lang="lang_english.php";

所以我将变量$ main_dir更改为&#34; ../ mailist /&#34;

然后在shane / shane_about.php上工作,然后index.php和news.php有同样的问题(搞砸了)。

我确信解决方案非常基础,任何想法都会受到赞赏。 谢谢Chris

1 个答案:

答案 0 :(得分:2)

$main_dir更改为绝对路径。

如果它与$absolute_path相同,则不会出现此问题。

$main_dir = "/hostingcompanyserver/something/something/something.com/maillist/";

目前的问题是index.php和news.php看起来是由$main_dir定义的maillist内部。 shane_about.php查看/ shane / maillist /.

然后你告诉它将目录转到maillist ..maillist/。这意味着shane_about.php看起来正确,但index.php和news.php却没有。

通过使用绝对路径,所有文件都在同一个地方。