我一直在寻找让我的导航栏在我的所有页面上都能正常工作,但它没有显示。我一直在使用php包含
这是我在“包含”文件夹中的导航栏:
<!DOCTYPE html>
<html>
<head>
<script src="jquery-3.2.1.min.js"></script>
</head>
<body>
<div class="nav-bar">
<div class='logo'>
<h1>Va Jugar</h1>
</div>
<div class='nav-buttons'>
<nav>
<a href="index.php">Home</a>
<a href="stuff.php">stuff</a>
<a href="contact.php">Contact</a>
</nav>
</div>
<div class="login">
<a class="fa fa-sign-in" aria-hidden="true" href="login.html"
title="Login"></a>
</div>
</div>
</body>
</html>
这是index.php代码:
<!DOCTYPE html>
<html>
<head>
<meta charset='UTF -8'>
<meta name="description" content='...' />
<title>my page</title>
<link rel='stylesheet' type='text/css' href='css/style.css'>
</head>
<body>
<div class="header">
<?php include_once ("includes/header.php";) ?>
</div>
</body>
</html>
我找不到我做错了但结果应该是顶部显示的导航栏,没有任何内容显示给我。另外,我是否也可以包含特定的导航栏样式页面?或者它必须在index.html和一个特定的style.css文件上。
答案 0 :(得分:2)
您附带的文件应该只包含您在其中包含的地方放置的源代码。
您不应该在所包含的文件中包含doctype,html,head和body,而只能使用
127.0.0.1 - - [04/Dec/2017 08:09:34] "GET /cgi-bin/login.py HTTP/1.1" 200 -
127.0.0.1 - - [04/Dec/2017 08:09:39] code 404, message File not found
127.0.0.1 - - [04/Dec/2017 08:09:39] "GET /action_page.php?uname=a&psw=b HTTP/1.1" 404