Home >Backend Development >PHP Tutorial >Phison-up10 mass production tool v1.78.00 PHP text operation class
Copy the code The code is as follows:
class CtbClass {
var $file; var $index;
//Create a file and write input
Function null_write($new)
,"w"); fclose($f); { / With the return of Readfile (), convert a line of data into a one -dimensional array
Function Make_array ($ LINE) {
$ array = Explode ("x0e", $ line);
RETURN $ array; Convert a row of data into a one-dimensional array
return $array;
}文 // The number of rows returned to the data file
Function getlines () {
$ f = file ($ this- & gt; file);
Return Count ($ f); ) $this->get(); ()
{ for($i=0;$i<=$this->index;$i++) { $line=explode("x0E",$rec); }
flock($f,LOCK_SH); =0;$i<=$this->index;$i++) { " Function read_file() { line =file($this->file);
array_push($lines, $tmpline); return $lines ;
line = implode("x0E",$array); ->file,"w");
"a"); If ($check_n==1) fputs($f,"n");
newfile = implode("x0E",$array);
");
FLOCK ($ F, LOCK_SH);
While ($ LINE = FGETS ($ F, 1024)) {
$ newfile. = $ Line;
}
fclose ($ f); $this->file,"w");
implode("x0E",$update_array);
$newfile $f=fopen($this->file,"r"); ($ i = 0; $ i & lt; count ($ fc); $ i ++) {
$ list = Explode ("x0e", $ fc [$ i]); ) f=fopen($this->file,"w"); fclose($f); 符 // Update all eligible data records, suitable for the situation where each row of byte data is smaller. ;; flock ($f,LOCK_SH); $ TMPLINE = Explode ("X0e", $ LINE);
IF ($ TMPLINE [$ colorn] == $ query_string) {
$ newfile. = $ newline; ;
}
flock ($f, LOCK_EX); f);
}
;file); for ($i=0;$i
)."n";
$f=fopen($this->file,"w"); s($f, $newfile);
;file,"r"); tmpLine[$column] != $query_string) {
($this->file,"w");
($f,LOCK_EX); //Get the maximum value of a field in a file = file($this->file); de("x0E",$tlines[$i]) ; // Query based on whether a field in the data file contains $query_string, and return all qualified data as a two-dimensional array column, $query_string) { )
;file)) {
read_file();
$line = $this->make_array($tmpLine);
$lines[]= $tmpLine; 的 // Whether a field of the data file contains $ Query_String to query, and return the first qualified data with a one-dimensional array
Function Select_line ($ colorn, $ query_string) {
$ TLINE = $ This- & GT; Read_file. { ; ;
;
// select next/prev line(next_prev ==> 1/next, 2/prev) by cx
function select_next_prev_line($column, $query_string, $next_prev) {
$tline = $this->read_file();
$line_key_end = count($tline) - 1;
$line_key = -1;
foreach ($tline as $tmpLine) {
$line_key++;
$line = $this->make_array($tmpLine);
if ($next_prev == 1) { // next?
if ($line[$column] == $query_string) {
if ($line_key == 0) {
return 0;
} else {
$line_key_up = $line_key - 1;
return $up_line;
}
} else {
$up_line = $line;
}
} elseif ($next_prev == 2) { // prev?
if ($line[$column] == $query_string) {
if ($line_key == $line_key_end) {
return 0;
} else {
$line_key_down = $line_key + 1;
break;
}
}
} else {
return 0;
}
}
$down_line = $this->make_array($tline[$line_key_down]);
return $down_line;
}
}
?>
以上就介绍了phison-up10量产工具v1.78.00 PHP文本操作类,包括了phison-up10量产工具v1.78.00方面的内容,希望对PHP教程有兴趣的朋友有所帮助。