怎么读取text文件,显示原样格式

WBOY
Release: 2016-06-13 11:47:07
Original
1429 people have browsed it

如何读取text文件,显示原样格式?
如何读取text文件,显示原样格式?

原样格式: namelist.txt



php 显示格式t:


页面代码:
$file_handle = fopen("d:/data/namelist.txt", "r");

while (!feof($file_handle)) {

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

}

fclose($file_handle);
?>
------解决方案--------------------

$file_handle = fopen("d:/data/namelist.txt", "r");<br />echo '<pre class="brush:php;toolbar:false">';<br />while (!feof($file_handle)) {<br />  $line_of_text = fgets($file_handle);<br />  print $line_of_text . "<BR>";<br />}<br />echo '
Copy after login
';

fclose($file_handle);

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template