Php包括声明不起作用

时间:2013-10-04 04:47:51

标签: php

我已经为我最新的网络项目尝试过include语句,但它无法正常工作

    

<script src="Additionl Pages/mm_css_menu.js"></script>
<link rel="stylesheet" type="text/css" href="Additionl Pages/Header.css" />

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Home</title>
</head>
<?php
include('C:\wamp\www\Bank web\Additionl Pages\Header.html'); //header menu
?>
<?php
include('\wamp\www\Bank web\Additionl Pages\Slideshow\slideshow.html'); //slideshow
?>
<?php
include('C:\wamp\www\Bank web\Additionl Pages\logo.html');  //logo
?>
<body>
</body>
</html>

1 个答案:

答案 0 :(得分:2)

尝试在您的身体标签之间放置包含,如下所示:

PS:您忘记了开始html标记,并且您的scriptlink标记位于您的标记之间。您还忘记了第二个包含中的C:\。我在下面修了它。

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>Home</title>
        <script src="Additionl Pages/mm_css_menu.js"></script>
        <link rel="stylesheet" type="text/css" href="Additionl Pages/Header.css" />
    </head>
    <body>
        <?php
        include('C:\wamp\www\Bank web\Additionl Pages\Header.html'); //header menu
        ?>
        <?php
        include('C:\wamp\www\Bank web\Additionl Pages\Slideshow\slideshow.html'); //slideshow
        ?>
        <?php
        include('C:\wamp\www\Bank web\Additionl Pages\logo.html');  //logo
        ?>
    </body>
</html>

编辑:此外,不需要多个php标记。您可以在一个php标记中执行相同的操作,如下所示:

<?php
    include('C:\wamp\www\Bank web\Additionl Pages\Header.html'); //header menu
    include('C:\wamp\www\Bank web\Additionl Pages\Slideshow\slideshow.html'); //slideshow
    include('C:\wamp\www\Bank web\Additionl Pages\logo.html');  //logo
?>