包括外部标头不起作用

时间:2016-09-24 11:25:32

标签: php html include

我不能在PHP 5.6 <?php include ("Menu.html"); ?>`中包含外部头文件.html 但结果菜单从未显示过。这是My full project

这是外部的Menu.html文件(带标题):

<!-- Basic Page Needs
        ================================================== -->
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="icon" type="image/png" href="images/favicon.png">
<meta name="description" content="">
<meta name="keywords" content="">
<meta name="author" content="Dan Caldr">
<!-- Mobile Specific Metas
        ================================================== -->
<meta name="format-detection" content="telephone=no">
<meta name="viewport" content="width=device-width, initial-scale=1">

<!-- Template CSS Files
        ================================================== -->
<!-- Twitter Bootstrs CSS -->
<link rel="stylesheet" href="css/bootstrap.min.css">
<!-- Ionicons Fonts Css -->
<link rel="stylesheet" href="css/ionicons.min.css">
<!-- animate css -->
<link rel="stylesheet" href="css/animate.css">
<!-- Hero area slider css-->
<link rel="stylesheet" href="css/slider.css">
<!-- owl craousel css -->
<link rel="stylesheet" href="css/owl.carousel.css">
<link rel="stylesheet" href="css/owl.theme.css">
<link rel="stylesheet" href="css/jquery.fancybox.css">
<!-- template main css file -->
<link rel="stylesheet" href="css/main.css">
<!-- responsive css -->
<link rel="stylesheet" href="css/responsive.css">

<!-- Template Javascript Files
        ================================================== -->
<!-- modernizr js -->
<script src="js/vendor/modernizr-2.6.2.min.js"></script>
<!-- jquery -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<!-- owl carouserl js -->
<script src="js/owl.carousel.min.js"></script>
<!-- bootstrap js -->

<script src="js/bootstrap.min.js"></script>
<!-- wow js -->
<script src="js/wow.min.js"></script>
<!-- slider js -->
<script src="js/slider.js"></script>
<script src="js/jquery.fancybox.js"></script>
<!-- template main js -->
<script src="js/main.js"></script>

<header id="top-bar" class="navbar-fixed-top animated-header">
  <div class="container">
    <div class="navbar-header">
      <!-- responsive nav button -->
      <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <!-- /responsive nav button -->

      <!-- logo -->
      <div class="navbar-brand">
        <a href="index.html">
          <img src="images/logo.png">
        </a>
      </div>
      <!-- /logo -->
    </div>
    <!-- main menu -->
    <nav class="collapse navbar-collapse navbar-right" role="navigation">
      <div class="main-menu">
        <ul class="nav navbar-nav navbar-right">
          <li> <a href="index.html">Hlavní strana</a>
          </li>
          <li><a href="about.html">About</a>
          </li>
          <li><a href="service.html">Service</a>
          </li>
          <li class="dropdown">
            <a href="#" class="dropdown-toggle" data-toggle="dropdown">Služby <span class="caret"></span></a>
            <div class="dropdown-menu">
              <ul>
                <li><a href="404.html">404 Page</a>
                </li>
                <li><a href="gallery.html">Gallery</a>
                </li>
              </ul>
            </div>
          </li>
          <li class="dropdown">
            <a href="#" class="dropdown-toggle" data-toggle="dropdown">Blog <span class="caret"></span></a>
            <div class="dropdown-menu">
              <ul>
                <li><a href="blog-fullwidth.html">Blog Full</a>
                </li>
                <li><a href="blog-left-sidebar.html">Blog Left sidebar</a>
                </li>
                <li><a href="blog-right-sidebar.html">Blog Right sidebar</a>
                </li>
              </ul>
            </div>
          </li>
          <li><a href="contact.html">Kontakt</a>
          </li>
        </ul>
      </div>
    </nav>
    <!-- /main nav -->
  </div>
</header>

这是我想插入Menu.html

的文件

<!DOCTYPE html>
<html class="no-js">

<head>
  <!-- Basic Page Needs
        ================================================== -->
  <meta charset="utf-8">
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <link rel="icon" type="image/png" href="images/favicon.png">
  <title>Internetové poradenství & služby</title>
  <meta name="description" content="">
  <meta name="keywords" content="">
  <meta name="author" content="Dan Caldr">
  <!-- Mobile Specific Metas
        ================================================== -->
  <meta name="format-detection" content="telephone=no">
  <meta name="viewport" content="width=device-width, initial-scale=1">

  <!-- Template CSS Files
        ================================================== -->
  <!-- Twitter Bootstrs CSS -->
  <link rel="stylesheet" href="css/bootstrap.min.css">
  <!-- Ionicons Fonts Css -->
  <link rel="stylesheet" href="css/ionicons.min.css">
  <!-- animate css -->
  <link rel="stylesheet" href="css/animate.css">
  <!-- Hero area slider css-->
  <link rel="stylesheet" href="css/slider.css">
  <!-- owl craousel css -->
  <link rel="stylesheet" href="css/owl.carousel.css">
  <link rel="stylesheet" href="css/owl.theme.css">
  <link rel="stylesheet" href="css/jquery.fancybox.css">
  <!-- template main css file -->
  <link rel="stylesheet" href="css/main.css">
  <!-- responsive css -->
  <link rel="stylesheet" href="css/responsive.css">

  <!-- Template Javascript Files
        ================================================== -->
  <!-- modernizr js -->
  <script src="js/vendor/modernizr-2.6.2.min.js"></script>
  <!-- jquery -->
  <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
  <!-- owl carouserl js -->
  <script src="js/owl.carousel.min.js"></script>
  <!-- bootstrap js -->

  <script src="js/bootstrap.min.js"></script>
  <!-- wow js -->
  <script src="js/wow.min.js"></script>
  <!-- slider js -->
  <script src="js/slider.js"></script>
  <script src="js/jquery.fancybox.js"></script>
  <!-- template main js -->
  <script src="js/main.js"></script>
  <!-- Insert files THIS IS NOT WORKING-->
  <link rel="import" href="Menu.html">
</head>

<body>
  <!--
        ==================================================
        Slider Section Start
        ================================================== -->
  <section id="hero-area">
    <div class="container">
      <div class="row">
        <div class="col-md-12 text-center">
          <div class="block wow fadeInUp" data-wow-delay=".3s">

            <!-- Slider -->
            <section class="cd-intro">
              <h1 class="wow fadeInUp animated cd-headline slide" data-wow-delay=".4s"> <span>Zajímáte se o</span><br>
              <span class="cd-words-wrapper"> <b class="is-visible">Získání více klientů?</b> <b>získání úspěchu na sociálních sítích?</b> <b>zefektivnění čiností?</b> <b> cokoliv jiného? </b> </span> </h1>
            </section>
            <!-- cd-intro -->
            <!-- /.slider -->
            <h2 class="wow fadeInUp animated" data-wow-delay=".6s"> 
            <!-- Přidat něco o internetu--> "Internet je místo neuvěřitelných možností."<br>
            A rozhodně může výrazně pomct i vám.<br>
          </h2>
            <a class="btn-lines dark light wow fadeInUp animated smooth-scroll btn btn-default btn-green" data-wow-delay=".9s" href="#works" data-section="#works">nabídka</a> 
          </div>
        </div>
      </div>
    </div>
  </section>
  <section id="about">
    <div class="container">
      <div class="row">
        <div class="col-md-6 col-sm-6">
          <div class="block wow fadeInLeft" data-wow-delay=".3s" data-wow-duration="500ms">
            <h2> O mně </h2>
            <p>Díky několikaleté praxi jsem schopný pracovat s témněř jakýmkoliv programem. Vím jak fungují vyhledávače a jak Vás posunout nahoru. Umím perfektně zacházet se sociálními sítěmi.</p>
            <p>Vím, že univerzální řešení nemusí každému vyhovovat, a proto se snažím, aby moje služby byly efektivní a zároveň přátelské.</p>
          </div>
        </div>
        <div class="col-md-6 col-sm-6">
          <div class="block wow fadeInRight" data-wow-delay=".3s" data-wow-duration="500ms">
            <img src="images/about/about.jpg" alt="">
          </div>
        </div>
      </div>
    </div>
  </section>
  <!--/#main-slider-->
  <!--
            ==================================================
            Slider Section Start
            ================================================== -->
  <!-- /#about -->
  <!--
            ==================================================
            Portfolio Section Start
            ================================================== -->
  <section id="works" class="works">
    <div class="container">
      <div class="section-heading">
        <h1 class="title wow fadeInDown" data-wow-delay=".3s">moje nabídka</h1>
        <p class="wow fadeInDown" data-wow-delay=".5s">Soustředím se na tyto oblasti
          <br>Pokud potřebujete něco jiného můžete mě kontaktovat a já Vám zkusím připravit speciální řešení</p>
      </div>
      <div class="row">
        <div class="col-sm-4 col-xs-12">
          <figure class="wow fadeInLeft animated portfolio-item" data-wow-duration="500ms" data-wow-delay="0ms">
            <div class="img-wrapper">
              <img src="images/portfolio/item-1.jpg" class="img-responsive" alt="this is a title">
              <div class="overlay">
                <div class="buttons"> <a rel="gallery" class="fancybox" href="images/portfolio/item-1.jpg">Demo</a>  <a target="_blank" href="single-portfolio.html">Details</a> 
                </div>
              </div>
            </div>
            <figcaption>
              <h4> <a href="#"> Pro podnikání </a> </h4>
              <p>Obchody, hotely, kadeřnictví...</p>
            </figcaption>
          </figure>
        </div>
        <div class="col-sm-4 col-xs-12">
          <figure class="wow fadeInLeft animated" data-wow-duration="500ms" data-wow-delay="300ms">
            <div class="img-wrapper">
              <img src="images/portfolio/item-2.jpg" class="img-responsive" alt="this is a title">
              <div class="overlay">
                <div class="buttons"> <a rel="gallery" class="fancybox" href="images/portfolio/item-2.jpg">Demo</a>  <a target="_blank" href="single-portfolio.html">Details</a> 
                </div>
              </div>
            </div>
            <figcaption>
              <h4> <a href="#"> Webové stránky </a> </h4>
              <p>Založení, přesun, nástroje, oprava...</p>
            </figcaption>
          </figure>
        </div>
        <div class="col-sm-4 col-xs-12">
          <figure class="wow fadeInLeft animated" data-wow-duration="500ms" data-wow-delay="300ms">
            <div class="img-wrapper">
              <img src="images/portfolio/item-3.jpg" class="img-responsive" alt="">
              <div class="overlay">
                <div class="buttons"> <a rel="gallery" class="fancybox" href="images/portfolio/item-3.jpg">Demo</a>  <a target="_blank" href="single-portfolio.html">Details</a> 
                </div>
              </div>
            </div>
            <figcaption>
              <h4> <a href="#"> Sociální sítě & další </a> </h4>
              <p>Youtube, Facebook... A jiné služby</p>
            </figcaption>
          </figure>
        </div>
      </div>
    </div>
  </section>
  <!-- #works -->
  <!--
            ==================================================
            Portfolio Section Start
            ================================================== -->
  <section id="feature">
    <div class="container">
      <div class="section-heading">
        <h1 class="title wow fadeInDown" data-wow-delay=".3s">Offer From Me</h1>
        <p class="wow fadeInDown" data-wow-delay=".5s">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Sed,
          <br>quasi dolores numquam dolor vero ex, tempora commodi repellendus quod laborum.</p>
      </div>
      <div class="row">
        <div class="col-md-4 col-lg-4 col-xs-12">
          <div class="media wow fadeInUp animated" data-wow-duration="500ms" data-wow-delay="300ms">
            <div class="media-left">
              <div class="icon"> <i class="ion-ios-flask-outline"></i> 
              </div>
            </div>
            <div class="media-body">
              <h4 class="media-heading">Media heading</h4>
              <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Voluptatum, sint.</p>
            </div>
          </div>
        </div>
        <div class="col-md-4 col-lg-4 col-xs-12">
          <div class="media wow fadeInDown animated" data-wow-duration="500ms" data-wow-delay="600ms">
            <div class="media-left">
              <div class="icon"> <i class="ion-ios-lightbulb-outline"></i> 
              </div>
            </div>
            <div class="media-body">
              <h4 class="media-heading">Well documented.</h4>
              <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Voluptatum, sint.</p>
            </div>
          </div>
        </div>
        <div class="col-md-4 col-lg-4 col-xs-12">
          <div class="media wow fadeInDown animated" data-wow-duration="500ms" data-wow-delay="900ms">
            <div class="media-left">
              <div class="icon"> <i class="ion-ios-lightbulb-outline"></i> 
              </div>
            </div>
            <div class="media-body">
              <h4 class="media-heading">Well documented.</h4>
              <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Voluptatum, sint.</p>
            </div>
          </div>
        </div>
        <div class="col-md-4 col-lg-4 col-xs-12">
          <div class="media wow fadeInDown animated" data-wow-duration="500ms" data-wow-delay="1200ms">
            <div class="media-left">
              <div class="icon"> <i class="ion-ios-americanfootball-outline"></i> 
              </div>
            </div>
            <div class="media-body">
              <h4 class="media-heading">Free updates</h4>
              <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Voluptatum, sint.</p>
            </div>
          </div>
        </div>
        <div class="col-md-4 col-lg-4 col-xs-12">
          <div class="media wow fadeInDown animated" data-wow-duration="500ms" data-wow-delay="1500ms">
            <div class="media-left">
              <div class="icon"> <i class="ion-ios-keypad-outline"></i> 
              </div>
            </div>
            <div class="media-body">
              <h4 class="media-heading">Solid Support</h4>
              <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Voluptatum, sint.</p>
            </div>
          </div>
        </div>
        <div class="col-md-4 col-lg-4 col-xs-12">
          <div class="media wow fadeInDown animated" data-wow-duration="500ms" data-wow-delay="1800ms">
            <div class="media-left">
              <div class="icon"> <i class="ion-ios-barcode-outline"></i> 
              </div>
            </div>
            <div class="media-body">
              <h4 class="media-heading">Simple Installation</h4>
              <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Voluptatum, sint.</p>
            </div>
          </div>
        </div>
      </div>
    </div>
  </section>
  <!-- /#feature -->
</body>

</html>

由于

1 个答案:

答案 0 :(得分:0)

将主文件命名为.php

例如:如果您的文件名为index.html,则将其重命名为index.php

第二步还将菜单文件重命名为menu.php而不是menu.html

然后你可以这样做

索引文件中的

old value

永远记住,如果你想在PHP中包含文件,他们应该有.php扩展名

另请记住,您所包含的文件也应该具有.php扩展名

例如:如果你在index.html中包含menu.php那么它就不会工作