Page 1 of 1

output text without format

Posted: Mon Feb 17, 2014 2:07 am
by weixin268
Hello!

have a php page to read text file, but without text format, how to fix it? Thanks!

Original Text File format as shown on below: namelist.txt
https://drive.google.com/file/d/0B0uU4S ... sp=sharing


php displayed format:
https://drive.google.com/file/d/0B0uU4S ... sp=sharing

code page:

Code: Select all

<?php 
$file_handle = fopen("d:/data/namelist.txt", "r");

while (!feof($file_handle)) {

$line_of_text = fgets($file_handle);
print $line_of_text . "<BR>";

}

fclose($file_handle);
?>

Re: output text without format

Posted: Mon Feb 17, 2014 4:16 am
by weixin268
solved as shown on below:

<?php
$file_handle = fopen("d:/data/namelist.txt", "r");
[text][/text]echo '<pr>';
while (!feof($file_handle)) {

$line_of_text = fgets($file_handle);
print $line_of_text . "";

}
echo '</pr>';
fclose($file_handle);
?>