知识屋:更实用的电脑技术知识网站
所在位置:首页 > 编程技术 > PHP编程

php 文件操作

发布时间:2015-05-27 19:28:30作者:知识屋

print?ini_set('memory_limit', '-1');        //  
ini_set("max_execution_time", "3600"); //设置超时时间  
 
$filep='qq.txt'; 
 
 
$str=file('qq.txt'); 
 $lineCount = 0; 
   foreach( $str AS $line ) { 
       $line = str_replace( "/t", "    ", $line ); 
        $tr = trim( $line ); 
            if ( preg_match( "///*|^/*|^ {1,}/*|///*|/*//|^ {1,}////|^/////", $line ) || $tr === "" ) { 
            continue; 
            } 
            $lineCount++; 
         
        $line = str_replace( "/r", "", $line ); 
         $line = str_replace( "/n", "", $line ); 
           if($lineCount<5){ 
            is_m('5.txt',"".$line."@qq.com/n"); 
             continue; 
           }elseif ($lineCount <10){ 
              is_m('10.txt',"".$line."@qq.com/n"); 
                break; 
           } 
            
         
        } 
 
         
         
    function is_m($filename,$c){ 
         $handle = fopen($filename, "a"); 
         if ($handle) { 
         fwrite($handle, $c ); 
         fclose($handle); 
        } } 
(免责声明:文章内容如涉及作品内容、版权和其它问题,请及时与我们联系,我们将在第一时间删除内容,文章内容仅供参考)
收藏
  • 人气文章
  • 最新文章
  • 下载排行榜
  • 热门排行榜