我正在尝试使用将我的网站的标题包含在 phpbb3 html 文件的标题中
<!-- INCLUDEPHP ../../../../header.inc -->
我正在使用一个不起作用的 inc 文件,当我使用它时它可以工作
<!-- INCLUDE ../../../../header.inc -->
但php没有。我还尝试创建一个名为 header.php 的 php 文件,其中包含以下内容
<?php include("header.inc"); ?>
但这无济于事!我怎样才能让它工作!
您需要登录到 PHPBB3 板的管理并在模板中启用 PHP 代码
完成后,您可以使用以下代码在 html 模板文件中执行 php:
<!-- PHP --> include("externalFile.php"); <!-- ENDPHP -->
有关在 PHPBB HTML 模板中使用 PHP 的更多信息,请参阅此博客文章。 http://www.velvetblues.com/web-development-blog/add-php-code-to-your-phpbb-forum-templates/
您需要使用绝对路径
<?php include('/home/usr_name/www/includes/inc/header.inc') ?>
或相对路径
<?php include('../../../../header.inc') ?>
不,你不能在 html 文件(.html 扩展名)中包含 php 文件,除非你给文件一个 .php 扩展名。
如果您的文件名为 header.php,那么您可以使用
<?php include("header.inc"); ?>
只要确保路径正确,也许:
<?php include("../../../../header.inc"); ?>