Joke Collection Website - Public benefit messages - How to Analyze Superlog (2G) Effectively with PHP

How to Analyze Superlog (2G) Effectively with PHP

This method can improve some efficiency: first store the results in variables and read them all before saving.

That is to say, put this code:

if (fwrite($handle_result,$ buffer)= = FALSE){

The echo "1 record cannot be written to the log.

";

}

other

{

The echo "1 record was successfully written into the log.

";

}

Replace with:

$ results. = $buffer。 ”\ r \ n”;

$ i++;

Then add the following before the while loop:

/* Initialize variables */

$ result =

$ I = 0;

After the loop ends, add:

if (fwrite($handle_result,$ result)= = FALSE){

Echo' failed to write to the log.

";

}

other

{

The echo "$i record was successfully written to the log.

";

}