php 读取文件readfile

<?php
    //读取文件
    //echo readfile('aa.txt');
    //打开文件更好的方法是fopen
    $f = fopen('aa.txt' , 'r') or die('unable to open file!!!');
    //echo $f;//Resource id #3
    //echo fread($f , filesize('aa.txt'));    //fread读取文件
    
    //echo fgets($f);//读取单行文件
    //feof 又叫end of file
    /*while(!feof($f)){
        echo fgets($f) . '<br/>';
    }*/
    //fgetc读取单个字符,谢谢
    while(!feof($f)){
        echo fgetc($f) . '<br/>';
    }
    
    fclose($f);
?>
原文地址:https://www.cnblogs.com/xudy/p/6059947.html