php包括在html页面上自我评论

时间:2016-05-26 09:11:59

标签: php html .htaccess

我已将网站中的页脚内容移动到名为footer.php的单独文件中,因为这会在所有页面中重复。

footer.php

<?php
    echo "<footer class="footer">
              <div class="container">
                  <p class="text-muted"><a href="contactus.html">Contact Us</a></p>
                  <p class="text-muted"> Copyright &copy; <span id="yearfooter"> </span>. All rights reserved.</p>
              </div>
          </footer>";
?>

我已使用footer.php

<?php include 'footer.php';?>添加到我的index.html中

我还创建了一个.htaccess文件,其中包含以下内容:

的.htaccess

AddType application/x-httpd-php .html

但是,我的index.html页面中没有显示页脚。当我使用firebug检查index.html页面时,我可以看到php包括我给出了评论<!--?php include 'footer.php';?-->。我没有在index.html文件中对它进行评论。这是我使用php的第一天,感谢任何帮助。

更新

footer.php

<?php
    echo '<footer class="footer">
              <div class="container">
                  <p class="text-muted"><a href="contactus.html">Contact Us</a></p>
                  <p class="text-muted"> Copyright &copy; <span id="yearfooter"> </span>. All rights reserved.</p>
              </div>
          </footer>';
?>

更新

我设法让这个工作。我的php5.conf文件中有一些配置问题。删除了我添加的配置,它现在运行得很好。

0 个答案:

没有答案