<?php
//file(),接收参数为文件名(不是句柄),将文件以“行”分组传入一个数组,返回值为数组
$filePath = '/Users/Cuffica/Desktop/addicted.rtf';
$array = file($filePath);
echo $array;
print_r($array);
echo '<br />';
echo '<br />';
//readfile()读出整个文件内容(包含输出到浏览器的功能),注意与fpassthru()区分(当前指针后读剩余的)
readfile($filePath);
echo readfile($filePath); //返回值int型,文件总字节数
echo '<br />';
echo '<br />';
echo file_get_contents($filePath); //读入数据到缓冲区,然后通过echo打印,无需打开关闭文件;需要php5以上支持
?>