doumeilmikv7099 2014-03-18 05:16
浏览 108

在html正文中的样式.txt文件

I have created a blog script with php i have also created an admin area, in the admin area it has a text box with a submit button, what happens is i type some text into the text box and press the submit code then it generates a text file into a folder, in the main index file i have put come php code that displays all the text files into a div, but i want to style the text files i have tryed many ways to style the text files without editing the text files themselves, any ideas? i can change the text files to .html or .doc, here is a link with the php files

  • 写回答

2条回答 默认 最新

  • doujian0265 2014-03-18 05:25
    关注

    Use div tag with class attribute to style your .txt file

    <?php
    foreach (glob("posts/*.txt") as $file) {
    $file_handle = fopen($file, "r");
    echo "<div class='styleTxt'>";
    while (!feof($file_handle)) {
        $line = fgets($file_handle);
        echo $line;
    }
    echo "</div>";
    fclose($file_handle);
    

    } ?>

    评论

报告相同问题?

悬赏问题

  • ¥15 微信公众平台自制会员卡可以通过收款码收款码收款进行自动积分吗
  • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
  • ¥15 gdf格式的脑电数据如何处理matlab
  • ¥20 重新写的代码替换了之后运行hbuliderx就这样了
  • ¥100 监控抖音用户作品更新可以微信公众号提醒
  • ¥15 UE5 如何可以不渲染HDRIBackdrop背景
  • ¥70 2048小游戏毕设项目
  • ¥20 mysql架构,按照姓名分表
  • ¥15 MATLAB实现区间[a,b]上的Gauss-Legendre积分
  • ¥15 delphi webbrowser组件网页下拉菜单自动选择问题