首頁 >後端開發 >php教程 >phison-up10量產工具v1.78.00 PHP文字操作類

phison-up10量產工具v1.78.00 PHP文字操作類

WBOY
WBOY原創
2016-07-29 08:35:10974瀏覽

複製程式碼 程式碼如下:

class CtbClass {   
           var  $file;    $index;       
       //建立一個檔案並寫入輸入   
       {   
                       $f=fopen($this->file,"w");           
                       flock($f,LOCK_EX);   
                       fputs($f,$new);           
                       fclose($f );     
           }   
          unction  add_write($new)  {             {為
                
                       flock ($f,LOCK_EX);   
                                        fclose($f);     
         配合readfile()的回傳一起使用,把一行資料轉換為一維數組   
           function  make_array($line)  {   
                       $array  =  explode("x0E",$line);   
                       return  $array;   
           }   
           //把為一維數組轉換一行數據   
           function  join_array($line)  {   
                       $array  =  join("x0E",$line);   
                       return  $array;   
           }
           //  返回數據文件的總行數   
           function  getlines()  {   
                       $f=file($this->file);           
                       return  count($f);           
           }   
           //  返回下一行的數據記錄(備用)   
           function  next_line()  {   
                       $this->index=$this->index++;           
                       return  $this->get();           
}   
           //  返回上一行的數據記錄(備用)   
           function  prev_line()  {   
                       $this->index=$this->index--;           
                       return  $this->get( );           
           }        flock($f,LOCK_SH);   
                                                  $rec=fgets($f,1024)             }
                       $line=explode("x0E",$   fclose($f);   
                           }
           //  與現有行程的資料記錄資料較大   
                         $f=fopen($this->file,"r");            $f,LOCK_SH );   
                       for($i=                        $rec=fgets($f,1024*5);             }   
                       $$問題=explode("x0E",$rec);   
                                return  $line;           
          開啟資料檔---以一維數組返回文件內容
           function  read_file()  {   
         this  {   
                                               }   
           🎜>           }
           //  開啟資料檔案---                 if  (file_exists($this->file))  {                $f  =file($ this->file);   
                                   $lines  =  array();   
                                   foreach  ($f  as  $rawline)  {   
                                               $tmpline  =  explode("x0E",$rawline);   
                                               array_push($  $tmpline);   
                                        }   
                    }   
           //  傳入一個陣列,合併成一行資料,重寫整個檔案   $array){   
                       $newline  =  implode("x0E",$array);               
                       $f  =  fopen($this->file,"w");   
                       flock($f,LOCK_EX);
                       fputs($f,$newline);      close($f);   
           }
           //  新增行資料中記錄至檔案末端   
                                  $s=implode("x0E",$array);            $f=fopen ($this->file,"a");           
                       flock($f,LOCK_EX);   
                       fputs($f,$s);           
                       if  ($check_n==1)  fputs($f           
                      }           
           //  插入中一行資料記錄至原始資料值   
                       以$newfile  =  implode( "x0E",$array);   
                       $f  =  fopen($this->file,"r");   
                       flock($f,LOCK_SH);   
                       while  ($line  =  fgets($f 1024))  {   
                                                }   
        🎜>                       $f  =  fopen($this->file,   $f  =  fopen($this->file,   $f  =  fopen($this->file,  ”); flock($f,LOCK_EX);   
                                fclose($f);   
           }
           //  更新上所有符合條件的資料記錄,針對每行位元組資料較大的情況   
         
                       以$update_string  =  implode("x0E ",$update_array);         
                   
                       $fc=file($this->file);    $f=fopen($this->file,"r");   
                       flock($f,LOCK_SH);       ($i=0;$i                ("x0E",$fc[$i ]);   new  ($fc[$i])."n";   
                        約鎜>                                 ing;   
                                       }   
                               $f=fopen($this->file,"w");   
flock($f,LOCK_EX);   
                                fclose($f);   
           }
           //  更新上所有符合條件的資料記錄,針對每行位元組資料較小的情況    
        
                       $newline  =  implode("x0E ",$update_array);         
                       $newfile  =  "";   
                       $f  =  fopen($this->file,"r");   
                       flock($f,LOCK_SH);   
                       while  ( $line  =  fgets($f,1024))  {   
                  explode("x0E",$line);   
                     $query_string)  {   
                        .=  $newline;   
                                                                                           }      
                       fclose($f);    f  =  fopen($this-> file,"w");   
                       flock($f,LOCK_EX);       flock($f,LOCK_EX);       flock($f.       fputs($f,$newfile);   
                   }
           //  刪除所有符合條件的數據記錄,適用於每行字節數據較大的情況   
           function  delete($column,$query_string)  {   
                       $newfile  =  "";               
                       $ fc=file($this->file);   
                                  flock($f,LOCK_SH);   
              ;$i                    fc[$i]);   
                          {   
                              file.chop($fc[$i])."n";   
                                        }   
                               $f=fopen($ this->file,"w");   
                               fputs($f,$newfile);   
                   }
           //  移除所有符合條件的資料記錄,適用於每行位元組資料較少的情況   
       
                       $newfile  =       $ f  =  fopen($this->file,"r");   
                       flock($f,LOCK_SH);   
                       while  ($line  =  fgets($f,1024))  {   
                                   $tmpLine  =  explode ("x0E",$line);   
                        new_string)  {     $line;   
                                        }   
                 f);   
                       $f               flock($f,LOCK_EX);   
                                 fclose( $f);   
           }   
       //使用其中一個$column)  {   
                       $ >                       for  ($i=0;$i                       }
               $get_max_value  =  max($get_value);    $get_max_value;   
           }   
   
   所有符合資格的資料   
           function  select($column,  $query_string)  {      $tline  =  $this->openfile();   
                                   foreach  ($tline  as $line)  {   
                           {   
                           $line);   
                                       }   
                   >           }
           //  作用與function  select()相同且速度可能略為提升   
     
                       if  (file_exists($this-                     $ tline  =  $this->read_file();   
                   tmpLine)  {   
                        =  $this->make_array($tmpLine);   
                      if  ($line[$column]  = =  $query_string)  {   
                                                           $lines[]=$tmpLine;   
                                               }   
                                   }   
                       }   
                       return  $lines;   
           }
           //  根據資料檔案的某一欄位是否包含$query_string查詢,以一維陣列傳回第一個符合條件的資料    ing)  {   
                       $tline  $this->read_file();   
                       foreach                               以$line  =                        if  ($line[$column]  ==  $ query_string)  {   
                                                                                        }   
    🎜>           }
           //  選擇下一個/上一個行(next_prev  ==>  1/下一個,      _next_prev_line($column,  $query_string,  $next_prev)  {   
           =  $this ->read_file();   
                                           $line_key  =  -1;          as  $tmpLine)  {   
                     
                                                                  
                               ==  $query_string)  {   
                                  if  ($line_key  ==  0)  {    🎜>                                                                               else  {   
                                             $line_key_up  =  $line_key  -  1;   
                                             返回  $up_line;   
                                                      }   
                                                           }  其他  {   
                                                          $up_line  =  $line;   
                                                           }  elseif  ($next_prev  ==                                    
                                 if  ($line_key  ==  $line_key_end )  {   
                                           返回0;           返回0;                       }else  {   
                                                                       $line_key_down  =  $line_key  +  1;   
                                                                        休息;   
                                                         }   
                                                }   
                                   }  其他  {   
                                                 返回0;   
                                  }   
                     }   
                       $ down_line  =  $this->make _array($tline[$line_key_down]);   
                     }   
   
}  
? > 

以上就介紹了phison-up10量產工具v1.78.00 PHP文字操作類,包括phison-up10量產工具v1.78.00方面的內容,希望對PHP教程有興趣的朋友有所幫助。

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn