在我的网站上,顶部栏、菜单和页脚作为php在html中的include指令,不适用于*.html文件只有index.html
在chrome检查器中,我看到de php include显示为命令!当重命名agenda.html时->agenda.php php_menu、php_topbar和php_footer正在重新工作
在过去,我不得不把一个";addhandler";在";。htaccess";
如何使al-html作为php 运行
index.html
<!--Top bar start-->
<?php
include 'php_topbar.php';
?>
php_footer.php
https://www.sportenmoedig.be/php_footer.php
php版本:https://sportenmoedig.be/version.php
当前PHP版本:7.3.23
.htaccess
AddHandler应用程序/x-httpd-php.php.htm.shtml.html
您不能在html
页面中使用<?php ?>
标记,<?php ?>
只能在php文件中使用。您可以将index.html
更改为index.php
PHP脚本的打开为<?php
,关闭为?>
在这些标签之外,您将能够插入您的html。这意味着,任何想要在其中使用PHP的页面都应该命名一个.PHP文件。
这个源代码将帮助您了解如何将PHP和HTML一起使用:
https://www.w3schools.com/php/php_syntax.asp