gpt4 book ai didi

php - html 网站的页眉和页脚 php 调用不起作用

转载 作者:太空宇宙 更新时间:2023-11-04 10:11:29 25 4
gpt4 key购买 nike

我的 header.php 和 footer.php 文件没有被 index.html 文件获取。我搜索了 Stackoverflow 并遵循了不同的变体,例如 <?php include("header.php"); ?>$("#header").load("header.html");但它仍然不起作用。我的代码如下,有人可以告诉我我做错了什么吗?

标题.php

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>aaaa</title>
<meta name="description" content="aaaa.">
<link rel='shortcut icon' href='myfavicon.ico' type='image/x-icon'/ >

<!-- Bootstrap -->
<link href="css/bootstrap.min.css" rel="stylesheet">

<!-- Custom CSS -->
<link href="css/custom.css" rel="stylesheet">
<!-- Custom Fonts -->
<link href='https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,300,700' rel='stylesheet' type='text/css'>
<!-- Font Awesome -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.1/css/font-awesome.min.css">

<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>

<header>
<!-- HEADER -->
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="index.html">
<img alt="aaaa" src="images/aa.png" height="30px">
</a>
</div>
</div><!--END CONTAINER FLUID-->
</nav>

Index.html

<?php include("header.php"); ?>
<div class="container-fluid">
<div class="row feature">
<img src="images/Homepage%20Banner.jpg" class="img-responsive" alt="aaaa">
<div class="feature-text col-xs-12 col-md-8 col-lg-6 col-md-offset-2 col-lg-offset-3">
<p>aaaaa</p>
</div><!--END FEATURE TXT-->
</div><!--END ROW FEATURES-->

最佳答案

PHP 代码位于扩展名为.php 的文件中。在 Header.php 中,如果您没有 php 代码,则只需将它们写在 .HTML 扩展名中,即 Header.html因此,将 index.html 重命名为 index.php

关于php - html 网站的页眉和页脚 php 调用不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37559642/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com