www.cahyonegoro.com www.cahyonegoro.com - 1 year ago 131
HTML Question

formatting txt in file_get_contents php

so i have this code to show txt file :

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

the txt file look like this:
enter image description here

in one clean html file, it looked like this:
the format is exactly like the txt file

but when i paste it in laravel with portoadmin template, the txt format is broken and it looked like this:
the format is broken

what is wrong whit that????

thanks before

Answer Source

Change your web-font into monospace-type font, like this. For example, if you render your "txt" file inside:

<div id="container">

Then make sure that #container file is using Monospace font:

#container {
    font-family: "Roboto Mono", monospace;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download