当前位置:Gxlcms > PHP教程 > 怎么读取text文件,显示原样格式

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

时间:2021-07-01 10:21:17 帮助过:4人阅读

如何读取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");
echo '
';
while (!feof($file_handle)) {
$line_of_text = fgets($file_handle);
print $line_of_text . "
";
}
echo '
';

fclose($file_handle);

人气教程排行