我不能包括我的 header

I can't include my header

<?php

require('../includes/config.inc.php');
include ('../includes/header.html');
$page_name = NAME;

$page_title = 'Home';
?>

<div  style="background-color:green;" class="container">
    <div class="section">
        <div class="row">
            <div class="col s6">
                <h3>Welkom</h3>
            </div>
            <div class="col s6">
                <h3>Welcome</h3>
            </div>
        </div>
    </div>
</div>

<?php include ('includes/footer.html');
?>

您好,

出于某种原因,我的 header 无法正常工作。

我的项目包含这些目录

根 --index.php - /登录 ----index.php --/包括 ----header.html ----config.inc.php

我的index.php正确显示header并完美继承配置文件,但是登录文件夹中的index.php不包含header。 它确实包括配置(需要)。

我尝试了 $_server['DOCUMENT_ROOT'] 之类的一些东西,但我无法让 header 出现。

嘿,试试在正斜杠前加一个句点,也试试不带句点或正斜杠

<?php

require('./includes/config.inc.php');
include ('./includes/header.html');
$page_name = NAME;

$page_title = 'Home';
?>

<div  style="background-color:green;" class="container">
    <div class="section">
        <div class="row">
            <div class="col s6">
                <h3>Welkom</h3>
            </div>
            <div class="col s6">
                <h3>Welcome</h3>
            </div>
        </div>
    </div>
</div>

<?php include ('includes/footer.html');
?>

只需将文件 *.html 重命名为 *.php

喜欢header.php、footer.php

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

ALL YOUR CONTENT HERE

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

请检查这个link:-https://css-tricks.com/forums/topic/how-to-include-php-headers-and-footers-on-html-site/