The homepage is about 3KB and was tested locally
Copy the code The code is as follows:
file_get_contents('shadow.xml ');
Took 0.0003 seconds
Copy code The code is as follows:
$indexFile = fopen('shadow.xml', 'r');while ( !feof($indexFile)) fgetc( $indexFile);
Took 0.026 seconds
Copy code The code is as follows:
$indexFile = fopen('shadow.xml', 'r');fread($indexFile, 10000);
It took 0.0003 seconds
The difference is nearly 100 times! ! It’s really unexpected
I guess all the time is lost in the while loop or something.
http://www.bkjia.com/PHPjc/324988.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/324988.htmlTechArticleThe homepage is about 3KB. The copied code for local testing is as follows: file_get_contents('shadow.xml'); consumption Copy the code in 0.0003 seconds. The code is as follows: $indexFile = fopen('shadow.xml', 'r'...