使用include()时,php无法使用引导
下面是我打算在index.php文件中使用的HTML代码,但似乎有一个问题使用include()时,php无法使用引导,php,html,css,twitter-bootstrap,Php,Html,Css,Twitter Bootstrap,下面是我打算在index.php文件中使用的HTML代码,但似乎有一个问题 <!-- nav bar --> <nav id="top"> <nav class="navbar navbar-xs navbar-custom"> <div class="container-fluid" > <div class="nav pull-right"> <font face="bebas">
<!-- nav bar -->
<nav id="top">
<nav class="navbar navbar-xs navbar-custom">
<div class="container-fluid" >
<div class="nav pull-right">
<font face="bebas">
<ul class="list-inline">
<li><a href="#"> 123456789 </a></li>
<li class="dropdown"><a href="#" title="My Account" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-user"></i> My Account <span class="caret"></span></a>
<ul class="dropdown-menu dropdown-menu-right">
<li><a href="#">Register</a></li>
<li><a href="#">Login</a></li>
</ul>
</li>
<li><a href="#" id="wishlist-total" title="Wish List (0)"><i class="fa fa-heart"></i> Wish List (0)</a></li>
<li><a href="#" title="Shopping Cart"><i class="fa fa-shopping-cart"></i> Shopping Cart</a></li>
<li><a href="#" title="Checkout"><i class="fa fa-share"></i> Checkout</a></li>
</ul>
</div>
</div>
</nav>
</nav>
<!-- searchbar and logo -->
<header id="margin">
<div class="container">
<div class="row">
<div class="col-xs-4">
<div id="logo">
<center> <span class="tab-space"></span> <a href="J:\lawn\home\home2.htm"><img src="J:\lawn\home\artwork\lawn.png" height="42px" /></a>
</div>
</div>
<div class="col-xs-5">
<div id="search" class="input-group">
<input type="text" name="search" value="" placeholder="Search" class="form-control" border-rad>
<span class="input-group-btn">
<button class="btn btn-secondary" type="button" style="border-radius: 0;">Search</button>
</span>
</div>
</div>
<div class="col-xs-3">
</div>
</div>
</div>
</font>
</header>
-
搜寻
index.php
<!DOCTYPE html>
<html>
<head>
<title> experiment ground </title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<!-- <meta name="viewport" content="width=device=width, initial-scale=1"> omitted to remove unresponsiveness of columns -->
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link href="J:\bootstrap\bootstrap-3.3.6-dist\css\bootstrap.min.css" rel="stylesheet" type="text/css">
<link href="J:\bootstrap\bootstrap-3.3.6-dist\css\cutom.css" rel="stylesheet" type="text/css">
<script src="J:\bootstrap\bootstrap-3.3.6-dist\js\bootstrap.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
</head>
<body>
<?php include('includes\header.html'); ?>
</body>
</html>
实验场
我想要一个像这样的输出,但我得到的只是。
这是一个问题,使用引导或其他完全。
我的主要目的是使用PHP的include()特性使代码最小化。有没有其他方法可以将页眉或页脚模板或代码包含到PHP页面中?
谢谢大家! 在包含引导之前链接jQuery
<link href="J:\bootstrap\bootstrap-3.3.6-dist\css\bootstrap.min.css" rel="stylesheet" type="text/css">
<link href="J:\bootstrap\bootstrap-3.3.6-dist\css\cutom.css" rel="stylesheet" type="text/css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"</script>
<script src="J:\bootstrap\bootstrap-3.3.6-dist\js\bootstrap.min.js"></script>
1) 打开开发人员工具(F12)
2) 刷新页面
3) 检查“控制台”选项卡
我想,你会在控制台中找到答案。
无论如何,请将路径更改为相对路径(假设文件index.php位于一个树级,带有引导目录):
而不是:
href="J:\bootstrap\bootstrap-3.3.6-dist\css\bootstrap.min.css"
并对所有文件执行此操作,或者仅从CDN连接—这将非常好;) 在bootstrap.min.js之前调用jquery.min.js
脚本bootstrap.min.js在大多数操作中使用jQuery插件
此外,请检查文件是否实际位于所述路径中。强烈建议您从主项目目录调用文件。请确保引导文件路径正确。请在浏览器中尝试链接href url并确认文件已正确放置您的引导资产有本地文件路径(J:\foo\bar)而不是http路径。这些看起来不太正确。这一定是一个文件路径问题。文件路径是正确的,但将引导文件放在项目目录中并进行更新,当然以某种方式使所有这些都起了作用,我不知道为什么会发生这种情况,以后不会发生,但它起作用了,谢谢!我复制了项目目录中的引导文件,它工作得很好,谢谢你,你救了我一天
href="J:\bootstrap\bootstrap-3.3.6-dist\css\bootstrap.min.css"