将extarnal文件中的代码导入到HTML中 [英] Import code from extarnal file to HTML

查看:178
本文介绍了将extarnal文件中的代码导入到HTML中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我有一个仅包含以下行的文本文件(test.txt):

 < h1>文本文字文字文字文字< / h1> 

是否有任何命令可以在HTML文档中调用此文本文件中的内容,因此文本文件中的内容导入调用的地方,每次显示时都显示?



示例:?????/ test.txt?解决方案我相信你的意思是询问是否存在一个允许包含文件的HTML命令。



纯HTML本身并不存在,但Apache 服务器端包含的确提供了这样的指示:

 <! - #include virtual =./ test.txt - > 

您将需要通过Web服务器启用SSI处理。在Apache中,你通常会调用你的文件 .shtml 或类似的东西。


Say I have a text file (test.txt) that contains only the following line:

<h1>Text text text text text</h1>

Is there any command that I can call the contents from this text file in an HTML document, so the contents in the text file imports where the call is made, every time the side shows?

Example: ?????"/test.txt"?????

解决方案

I believe you mean to ask whether there exists a "command" in HTML which allows you to include a file.

In pure HTML by itself there does not, but the Apache server-side includes does provide such a directive:

<!--#include virtual="./test.txt" -->

You will need to enable SSI processing by your webserver. In Apache, you'd typically call your file .shtml or something like that.

这篇关于将extarnal文件中的代码导入到HTML中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆