无法通过php include添加favicon

问题描述 投票:0回答:2

我试图添加一个它工作的图标但不是如果我使用包括我的标题在代码中。

我尝试了各种方法来添加favicon。此外,如果我把它放在主要代码中它完全有效。我试图硬连接图标也没用

所以这是主页

<!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>

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

我只是想让它显示图标。

php html
2个回答
1
投票

favicon属于head部分,你的是header

See W3C Specifications


0
投票

将此图标放在标签内。就像这样:

<head><link rel="shortcut icon" href="favicon.ico"></head>
© www.soinside.com 2019 - 2024. All rights reserved.