使用PHP时奇怪的上边距包括 [英] Weird top margin when using PHP include
问题描述
当我使用 include'';
时,出现了一些奇怪的问题。
问题是上边距。
用正常的代码
< HEAD>
< meta charset =utf-8>
< title>未绑定< / title>
< link rel =stylesheethref =css / foundation.css>
< link rel =stylesheethref =css / normalize.css>
< link rel =stylesheethref =css / custom.css>
< link rel =stylesheethref =css / component.css>
< script src =https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js>< / script>
< / head>
< header class =site-header>
< nav>
< div class =handle> Menu< / div>
< ul>
< a href =>< li class =logo>& nbsp;& nbsp;& nbsp;& nbsp;& nbsp;< / li>< / A>
< a href =>< li>主页< / li>< / a>
< a href =>< li> Equipa< / li>< / a>
< a href =>< li> Torneios< / li>< / a>
< a href =>< li>排名< / li>< / a>
< a href =>< li class =right> Registrar< / li>< / a>
< a href =>< li class =right>登入< / li>< / a>
< / ul>
< ul class =drop>
< a href =#>< li>主页< / li>< / a>
< / ul>
< / nav>
< div class =banner>
< / div>
< / header>
结果是:但是,当我将它们分成不同的php文件时
<?php include'includes / head.php'; ?>
<?php include'includes / header.php'; ?>
我得到了这个奇怪的结果:
enyone知道什么是问题吗?以及如何解决这个问题?
解决方案请记住有相同的问题和文本编码的原因。
尝试打开它与 Notepad ++ 并转换为不含BOM的UTF-8。 $ b
这里是关于带有BOM的UTF-8的快速解释。我希望它有帮助。
I am having some weird problem when I use the include '';
.
The problem is the margin on top.
with the normal code:
<head>
<meta charset="utf-8">
<title>Untittled</title>
<link rel="stylesheet" href="css/foundation.css">
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/custom.css">
<link rel="stylesheet" href="css/component.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
</head>
<header class="site-header">
<nav>
<div class="handle">Menu</div>
<ul>
<a href=""><li class="logo"> </li></a>
<a href=""><li>Home</li></a>
<a href=""><li>Equipa</li></a>
<a href=""><li>Torneios</li></a>
<a href=""><li>Ranking</li></a>
<a href=""><li class="right">Registrar</li></a>
<a href=""><li class="right">Login</li></a>
</ul>
<ul class="drop">
<a href="#"><li>Home</li></a>
</ul>
</nav>
<div class="banner">
</div>
</header>
The result is: But When I separate them into different php files
<?php include 'includes/head.php'; ?>
<?php include 'includes/header.php'; ?>
I got this weird result:
Does enyone knows what is the problem? and how to solve it?
It's been more than 4 years since my last experience with PHP, but I remember having the same problem and text encoding being the reason.
Try to open it with Notepad++ and convert to UTF-8 without BOM.
Here's a quick explanation on UTF-8 with BOM. I hope it helps.
这篇关于使用PHP时奇怪的上边距包括的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!