PHP include 不显示完整文件

PHP include does not show the full file

我正在尝试添加 html "piece"。这篇文章只是 header,顶部有评论:

<!--
Flex Web Core v2.0.2
Available in Perforce //FlexWeb/v2.0.2
Date: 2016-04-07T16:30:29
-->

<header class="page-header">
    <div class="page-header__inner"><a href="#" class="logo"></a>
    </div>
</header>

此文件名为 header-basic.html

在我的 index.php 文件中,我有这一行来包含 header-basic.html

 <?PHP include 'node_modules/flexwebcore/dist/html/blocks/header-basic.html'; ?>

basic-header html 没有显示(无论是包含 .php 还是 .html 文件)。当我检查代码时,我可以看到 header-basic 文件的注释,但我没有看到 HTML 被包含在内。有什么想法吗?

这是它包含的地方:

<body>
    <div class="page-container">
        <!-- Place Header Here -->
        <?PHP include 'node_modules/flexwebcore/dist/html/blocks/header-basic.html'; ?>
        <main class="page-main">
        </main>
    </div>
</body>

EDIT 所以,我相信我发现只有 header 和页脚文件没有显示。包含 <header><footer> 标签有问题吗?它们所在的位置有效。

改为尝试做 require_once 看看会发生什么.. 可能是因为评论.. 尝试删除评论并试一试...您可以将评论放到主文件中。

js/global.js 中,您有一个 Javascript 函数正在删除 <header> 元素:

function page_type_change(page_type) {
    $('header').remove();
    $('footer').remove();
    $('.page-container').removeClass('page-container--footer-full');
    //$('.page-container').prepend(getHeader(page_type));
    $('body').append(getFooter(page_type));
    if(page_type === "pre" || page_type === "post"){
        $('.page-container').addClass('page-container--footer-full');
    } else {
        $('.page-container').removeClass('page-container--footer-full');
    }
}

您需要修复此功能或您的 HTML 以符合您的要求。