0

所以我有一个页面,标题是这样的:

<div id="header">
<div id="logo"></div>
 <div id="menubar">
    <nav>
    <ul>
        <li><a href="index.php">Início</a></li>
        <li><a href="select_cafes.php">Cafés</a>
            <ul>
                <li><a href="select_cafes_murtosa.php">Murtosa</a></li>
                <li><a href="select_cafes_torreira.php">Torreira</a></li>
                <li><a href="select_cafes_monte.php">Monte</a></li>
                <li><a href="select_cafes_bunheiro.php">Bunheiro</a></li>
            </ul>
        </li>
        <li><a href="select_restaurantes.php">Restaurantes</a>
            <ul>
                <li><a href="select_restaurantes_murtosa.php">Murtosa</a></li>
                <li><a href="select_restaurantes_torreira.php">Torreira</a></li>
                <li><a href="select_restaurantes_monte.php">Monte</a></li>
                <li><a href="select_restaurantes_bunheiro.php">Bunheiro</a></li>
            </ul>
        </li>
        <li><a href="select_alojamentos.php">Alojamento</a>
            <ul>
                <li><a href="select_turismorural.php">Turismo Rural</a>
                    <ul>
                    <li><a href="select_turismorural_murtosa.php">Murtosa</a></li>
                    <li><a href="select_turismorural_torreira.php">Torreira</a></li>
                    <li><a href="select_turismorural_monte.php">Monte</a></li>
                    <li><a href="select_turismorural_bunheiro.php">Bunheiro</a></li>
                    </ul>
                </li>
                <li><a href="select_hoteis.php">Hotéis</a>
                    <ul>
                    <li><a href="select_hoteis_murtosa.php">Murtosa</a></li>
                    <li><a href="select_hoteis_torreira.php">Torreira</a></li>
                    <li><a href="select_hoteis_monte.php">Monte</a></li>
                    <li><a href="select_hoteis_bunheiro.php">Bunheiro</a></li>
                    </ul>
                </li>
                <li><a href="select_pensoes.php">Pensões</a>
                    <ul>
                    <li><a href="select_pensoes_murtosa.php">Murtosa</a></li>
                    <li><a href="select_pensoes_torreira.php">Torreira</a></li>
                    <li><a href="select_pensoes_monte.php">Monte</a></li>
                    <li><a href="select_pensoes_bunheiro.php">Bunheiro</a></li>
                    </ul>
                </li>
            </ul>
        </li>
        <li><a href="select_edificios.php">Edificios Municipais</a>
            <ul>
                <li><a href="select_edificios_murtosa.php">Murtosa</a></li>
                <li><a href="select_edificios_torreira.php">Torreira</a></li>
                <li><a href="select_edificios_monte.php">Monte</a></li>
                <li><a href="select_edificios_bunheiro.php">Bunheiro</a></li>
            </ul>
        </li>
        <li><a href="contato.php">Contato</a></li>
    </ul>
</nav>
</div>
</div>

我不想在每一页上重复这个,所以我试图把那个代码放在一个名为 header.php 的文件中。在 index.php 上,我删除了该代码并使用了<?php include(header.php);?>

它不起作用..有人可以帮助我吗?

4

2 回答 2

0

你忘了引号 -<?php include("header.php");?>

于 2013-06-27T21:58:33.000 回答
0

您需要header.php在引号之间设置包含的文件 ( )。

<?php include('header.php');?>

否则,你会得到一个错误。就像在这种情况下。

于 2013-06-27T21:59:48.203 回答