【发布时间】:2022-01-17 08:11:28
【问题描述】:
我正在制作一个网站来显示项目的代码,我需要一种方法来读取服务器上的文本文件,并且对于每一行,我需要它来使该行上的文本成为代码元素。
像这样:
输入(Example.txt):
Line 1
Line 2
Line 3
Line 4
Line 5
输出:
<code>Line 1</code>
<code>Line 2</code>
<code>Line 3</code>
<code>Line 4</code>
<code>Line 5</code>
【问题讨论】:
-
StackOverflow 不是免费的编码服务。你应该try to solve the problem first。请更新您的问题以在minimal reproducible example 中显示您已经尝试过的内容。如需更多信息,请参阅How to Ask,并拨打tour :)
标签: javascript html web