HTML中的PHP代码被注释掉


PHP code in HTML get commented out

当我把一些PHP代码放进example.html时,我的PHP代码没有显示在我的浏览器中(我使用chrome)。在Chrome的开发工具中,PHP标签

<?php include 'switch.php' ?>

成为

<?-- include 'switch.php' -->

我想知道为什么会这样。PHP代码被注释掉而不是被处理。

我有带有xampp的Windows 7。

将页面格式从.html更改为.php。然后你可以包括 php 文件!

Javascript和iframe也可以在php文件中工作,如果它们不在<?php ?>