www.cahyonegoro.com
www.cahyonegoro.com

Reputation: 185

Formatting txt in file_get_contents php

I have this code to show txt file :

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

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 with that?

Thanks in advance

Upvotes: 1

Views: 880

Answers (1)

krisanalfa
krisanalfa

Reputation: 6438

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

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

Then make sure that #container element is using monospace-type font. For instance:

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

Upvotes: 2

Related Questions