【问题标题】:Formatting txt in file_get_contents php在file_get_contents php中格式化txt
【发布时间】:2017-03-15 07:35:42
【问题描述】:

我有这个代码来显示 txt 文件:

<textarea rows="11" cols="190">
<?php
$file = file_get_contents('./test.txt', FILE_USE_INCLUDE_PATH);
echo $file;
?>
</textarea>

txt 文件如下所示:

在一个干净的 html 文件中,它看起来像这样:

但是当我使用 portoadmin 模板将它粘贴到 laravel 中时,txt 格式被破坏,它看起来像这样:

这有什么问题?

提前致谢

【问题讨论】:

    标签: php html laravel blade


    【解决方案1】:

    将您的网络字体更改为等宽字体,例如this。例如,如果你在里面渲染你的 txt 文件:

    <div id="container">
    </div>
    

    然后确保#container 元素使用monospace-type 字体。例如:

    #container {
        font-family: "Roboto Mono", monospace;
    }
    

    【讨论】:

    • 很高兴帮助你,兄弟。
    猜你喜欢
    • 1970-01-01
    • 2020-01-20
    • 1970-01-01
    • 2017-04-10
    • 2011-09-05
    • 2013-07-19
    • 1970-01-01
    • 2012-03-15
    • 1970-01-01
    相关资源
    最近更新 更多