当前位置: 动力学知识库 > 问答 > 编程问答 >

Read txt file in (html) page

问题描述:

First I don't know almost anything about HTML.

I have .txt file that looks like this

4WWWWWWWWWWWWW________________11111

1imeq_____________________22222

2i______________________33333

3Leteca pegla_______________44444

4name_____________________55555

1name_____________________66666

2name_____________________77777

3name_____________________88888

4name_____________________99999

1name_____________________00000

and I want to edit this page http://elektro-srb.webs.com/high-score so that it shows content of this file. File will update from time to time.

"_" is actually space in file but because of some strange formatting here I changed it.

I need as simple solution as it can be.

网友答案:

You can't do it with HTML. HTML is a markup language, you can't include a dynamic text in it.

You can use iframe and load the .txt file as a source, but note that this is not a vaild HTML format.

<iframe src="your_file.txt" />

If you're using s server side language you can load the .txt content. For example in php:

<?php
    echo file_get_contents("your_file.txt");
?>
分享给朋友:
您可能感兴趣的文章:
随机阅读: