服务器端的正确文件类型是什么?

What is the right type of file for server side includes

我一直在使用 html 和 css 编写网站代码。为了改进我的网站并提高效率,我一直在尝试将服务器端包含在我的页眉、nabber、内容部分和页脚中。我研究了许多不同的方法来做到这一点。到目前为止我已经想到了这个:

<!-- #include virtual="../includes/navbar.txt" -->
<!--#include virtual="../includes/content.txt"-->
<!--include virtual="../includes/footer.txt"-->
<!-- #include virtual="../includes/header.txt" -->

使用正确的感叹号语法等等。

这在使用 MAMP 或任何其他测试器进行测试时不起作用。 当使用 SSI 而不是 .txt 时,是否有其他类型的文件可以工作?谢谢!

包含SSI代码的文件的文件扩展名为.shtml

您可以将包含的文件保留为 .txt