1

I have written the header for my website in html and have included it with:

<?php include 'header.php'; ?>

At the beginning of all my pages. What I'm finding however is that it will only display the header if the first line is indented. If I don't leave empty space, the header will not show, and the following special characters will display at the top of my webpage ().

What should I do?

This is my header.php file:

<!doctype html>
<html>
   <head>
      <title>Page Title</title>
   </head>       
   <body>
      <h1>Title</h1>
      <ul>
         <li><a href="Homepage.php">Home</a></li>
         <li><a href="OurPractice.php">Practice</a></li>
         <li><a href="Services.php">Contact</a></li>
         <li><a href="CRT.php">Services</a></li>
         <li><a href="DryEye.php">Ect</a></li>
      </ul>

This is my body.php file:

<?php include 'header.php'; ?>
      This is my body text ect.
   </body>
</html>
4

2 回答 2

1

这是因为您的文件编码当前为 (UTF8-BOM),请尝试仅将其保存为 (UTF-8)。另请参阅这篇文章以获取更多信息:UTF-8 和没有 BOM 的 UTF-8 有什么不同?

于 2013-07-30T23:55:32.753 回答
0

添加到head部分:

<meta charset="utf-8">
于 2013-07-31T00:02:04.347 回答