使用PHP include将一个文件与它自己的包含文件一起包含


Using PHP include to include a file with it's own included file

我正试图将一个projects.php文件加载到一个更高级别的index.php文件中,并希望维护所有的.js .css和任何进一步嵌套的(在.js文件中).php文件,这些文件在projects.php文件中声明。

我的index.php文件如下:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>BLST</title>
</head>
<body>
    <?php $projectsPage = "/tables/php/projects.php"?>
    <li><a href="index.php?page=<?php echo $projectsPage;?>">Projects</a></li>
    <?php if(is_null($_GET["page"])) { 
                $page = ""; 
        }else{ 
            $page = $_GET["page"]; 
        } 
       include($page); 
    ?>
</body>
</html>

我的projects.php文件

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
    <head>
        <meta http-equiv="content-type" content="text/html; charset=utf-8" />
        <title>Projects</title>
        <style type="text/css">
            @import "css/test.css";
            @import "http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.23/themes/smoothness/jquery-ui.css";
        </style>
        <script type="text/javascript" language="javascript" charset="utf-8" src="js/jquery.min.js"></script>
    </head>

问题是没有找到projects.php中的文件。这是因为浏览器现在正在查找我的主目录(index.php所在目录)。

test.css在"tables/php/css/test.css"中,那么projects.php和index.php的位置呢?

我认为这些问题的答案将解决问题。