PHP - how to change title of the page AFTER including header.php?

前端 未结 9 1280
暗喜
暗喜 2020-12-13 03:10

page.php:


header.php:

<?php echo $title; ?>&         
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<ins class="adsbygoogle"
     style="display:block"
     data-ad-client="ca-pub-5408099190056760"
     data-ad-slot="7305827575"
     data-ad-format="auto"
     data-full-width-responsive="true"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>        </div>
      </div>
      
      <div class="fly-panel detail-box" id="flyReply">
        <fieldset class="layui-elem-field layui-field-title" style="text-align: center;">
          <legend>9条回答</legend>        </fieldset>

        <ul class="jieda" id="jieda">
                    <li data-id="111" class="jieda-daan">
            <a name="item-1111111111"></a>
            <div class="detail-about detail-about-reply">
                         <a class="fly-avatar" href="">
                <img src="https://www.e-learn.cn/qa/data/avatar/000/00/00/small_000000005.jpg" alt=" 抹茶落季 ">
              </a>
              <div class="fly-detail-user">
                <a href="" class="fly-link">
                  <cite> 抹茶落季</cite>
                                             
                </a>
                
                <span>(楼主)</span>
            
              </div>              <div class="detail-hits">
                <span>2020-12-13 03:43</span>
              </div>

            </div>
            <div class="detail-body jieda-body photos">
              <p>          
<p><strong>1. Simply add $title variable before require function</strong></p>

<pre><code><?php

$title = "Your title goes here";
require("header.php");

?>
</code></pre>

<p><strong>2. Add following code into header.php</strong> </p>

<pre><code><title><?php echo $title; ?>

提交回复
热议问题