sh0wtym3 Posted April 7, 2010 Share Posted April 7, 2010 I'm using the code below to read, and display a files contents: $filename = "style.css"; $handle = fopen($filename, "r+"); // Read the file, and store contents in a variable $content = fread($handle, filesize($filename)); // Close the connection fclose($handle); // Echo the contents echo "$content"; However when echoing the contents (its a CSS file), it "squishes" everything together, making it extremely difficult to read. Whereas in the actual style.css file theres formatting (like spaces between each line of CSS) making it easier to read. How do I preserve this formatting? Link to comment https://forums.phpfreaks.com/topic/197901-displaying-a-files-contents-with-formatting/ Share on other sites More sharing options...
sh0wtym3 Posted April 7, 2010 Author Share Posted April 7, 2010 Figured it out.... use <pre>$content</pre> if you are having similar issues Link to comment https://forums.phpfreaks.com/topic/197901-displaying-a-files-contents-with-formatting/#findComment-1038493 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.