无法通过php include

时间:2019-04-09 13:01:29

标签: php html

我试图添加一个favicon,但如果我使用include将我的标头包含在代码中,则不会。

我尝试了各种方式添加收藏夹图标。另外,如果我把它放在主代码中,它也可以正常工作。我试图硬链接收藏夹图标也没有用

所以这是主页

<!DOCTYPE html>
<!--Head-->
<head>
                <title>Accueil</title>
                <meta charset="utf-8">
                <meta name="viewport" content="width=device-width, initial-scale=1">

                <link rel="stylesheet" type="text/css" href="CSS/header-style.css">
                <link rel="stylesheet" type="text/css" href="CSS/style.css">
                <link rel="stylesheet" type="text/css" href="CSS/footer-style.css">
                <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
                <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
                <script src="myscripts.js"></script>

                <!--bootstrap-->
                <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.0/css/bootstrap.min.css" integrity="sha384-PDle/QlgIONtM1aqA2Qemk5gPOE7wFq8+Em+G/h$
                <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="$
                <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF8$
                <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.0/js/bootstrap.min.js" integrity="sha384-7aThvCh9TypR7fIc2HV4O/nFMVCBwyIUKL8XCtKE+8xgCgl/PQGuFsvSh$

</head>

<!--body-->
<body>

        <!-- HEADER -->
        <?php
                include 'inc/pages/header.php';
        ?>

        <!-- SLIDER -->
        <article class="slider">
                <div id="CarouselIndicatorsPictures" class="carousel slide" data-ride="carousel">
                  <ol class="carousel-indicators">
                        <li data-target="#CarouselIndicatorsPictures" data-slide-to="0" class="active"></li>
                        <li data-target="#CarouselIndicatorsPictures" data-slide-to="1"></li>
                        <li data-target="#CarouselIndicatorsPictures" data-slide-to="2"></li>
                  </ol>
                  <div class="carousel-inner">
                        <div class="carousel-item active">
                          <img class="carousel-item-img img-fluid center-block" src="inc/img/img1.jpg" alt="First slide">
                        </div>
                        <div class="carousel-item">
                          <img class="carousel-item-img img-fluid center-block" src="inc/img/img1.jpg" alt="Second slide">
                        </div>
                        <div class="carousel-item">
                          <img class="carousel-item-img img-fluid center-block" src="inc/img/img1.jpg" alt="Third slide">
                        </div>
                  </div>
                </div>
        </article>

        <!-- NEWSLETTER -->
        <article class="newsletter">
                <h4>Notre newsletter</h4>
                <p>Tu aimerais être tenu au courant de nos nouveauté ? Ne plus jamais rater nos soldes ? Avoir des réductions exclusive ?</p>
                <p>Alors inscris-toi vite à notre newsletter !</p>
                <form action="#" method="post" id="formNewsletter" class="row justify-content-center">
                        <input type="email" class="form-control" name="newsletter" placeholder="Inscris-toi et ne laisse plus jamais passer nos supers offres !">
                        <button type="submit" class="btn btn-info btn-arrow-right">Envoyer</button>
        </article>

        <!-- FOOTER -->
        <?php
                include 'inc/pages/footer.php';
        ?>

</body>



</html>


这是头文件(有点短)

<header>
 <link rel="shortcut icon" href="favicon.ico">
        <div class="row">
                <div class="col">
                        <form class="form-inline form-search">
                                <input class="form-control mr-sm-2 search-btn" type="search" placeholder="Chercher..." aria-label="Search">
                                <button class="btn btn-outline-success my-2 my-sm-0 search-button" type="submit">Chercher</button>
                        </form>
                        <a href="Accueil.php" class="img-header-smallscreen"><img src="inc/img/logo.png" alt="logo" height="50px" width="70px"/></a>
                </div>

                <div class="col icon-bar">
                        <a href="loremipsum.php"><i class="fa fa-info"></i></a>
                        <a href="moncompte.php"><i class="fa fa-user"></i></a>
                        <a class="active" href="#"><i class="fa fa-heart"></i></a>
                        <a href="MyCart.php"><i class="fa fa-cart-plus"></i></a>
                </div>
        </div>
</header>

这是很多代码,我知道很大一部分并不重要。

我只是想让它显示收藏夹图标。

2 个答案:

答案 0 :(得分:1)

收藏夹图标属于head的{​​{1}}部分

See W3C Specifications

答案 1 :(得分:0)

将此图标图标放入标签中。

<head><link rel="shortcut icon" href="favicon.ico"></head>