我编写了以下代码来两次输出文件的内容。但它只做了一次。这是为什么?
文本文件内容如下:
My name is Sam. Sam I am.
My name is Chris and Chris I am.
The brown fox jumped over the fence.
代码如下:
<?php
$file = "files/info.txt";
$handle = fopen($file, "rb");
echo fread($handle, filesize($file));
echo fread($handle, filesize($file));
?>
输出:
"My name is Sam. Sam I am. My name is Chris and Chris I am. The brown fox jumped over the fence."