DATE: 2017-10-16 17:15:58
关键在于将换行符转换为<br />
,实现代码:
$info=str_replace("\r\n","<br />",$info);
完整示例如下:
<?php
function get_post($path)
{
echo "<meta charset=utf-8>\r\n";
$fd = fopen($path, "r") or die("章节不存在!");
$info = fread($fd,filesize($path));
$info=str_replace("\r\n","<br />",$info);
echo $info;
fclose($fd);
}
?>