我想让html页面更容易编写,所以我制作了一个小的PHP脚本。它应该从文本文件中读取并以html格式编写。
html页面显示:";} fclose ($ f);?>
,尽管它应该显示:你好这是测试。
我的代码:
<div class="b_3">
<h2>Artikkelin nimi</h2>
<?php
$f = fopen("Tekstilaatikko.txt", "r");
while (!feof($f)) {
echo fgets($f) . "<br />";
}
fclose($f);
?>
</div>
我很抱歉我的英语不好。
确保.php
文件所在的文件夹中有文件Tekstilaatikko.txt
。
注:
此外,文件的扩展名应为.php
(如果你想让你的文件扩展名为.html,你需要做一些额外的配置)