PHP文件读写

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

    <?php  
    $handle  = @ fopen ( "demo.txt" ,  "r" );  
    if ( $handle ) {  
        while (( $buffer  =  fgets ( $handle ,  4096 )) !==  false ) {  
            echo  $buffer ;  
        }  
        if (! feof ( $handle )) {  
            echo  "Error: unexpected fgets() fail\n" ;  
        }  
        fclose ( $handle );  
    }  
      
    echo '<hr/>';  
      
    $length= readfile("demo.txt");  
      
    echo '<hr/>';  
      
    $file_str = 'demo.txt';  
      
    if(file_exists($file_str))  
    {  
        echo file_get_contents($file_str);  
          
    }  
      
    ?>