2016-11-02 2 views
1

Ich habe diesen Code txt-Datei anzuzeigen:Formatierung in file_get_contents php txt

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

die txt-Datei sieht wie folgt aus: enter image description here

in einer sauberen HTML-Datei, es sah wie folgt aus: the format is exactly like the txt file

aber wenn ich es in Laravel mit Portoadmin Vorlage einfügen, ist das TXT-Format kaputt und es sah so aus: the format is broken

Was ist daran falsch?

Vielen Dank im Voraus

Antwort

2

Ihre Web-Schriftart in Monospace-Type-Font ändern, wie this. Zum Beispiel, wenn Sie Ihre txt Datei in Render:

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

Dann stellen Sie sicher, dass #container Element monospace-type Schriftart verwendet. Zum Beispiel:

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

es funktionierte, danke –

+0

Froh, Ihnen zu helfen, bro. – Alfa