Php code that may be used 1. delay the request file to simulate scenarios with poor network speed. the code address is as follows: gist. github. com2650596? & Lt ;? Php *** delay. php? Ffile. js & amp; t100 ** the latency is 100 milliseconds to load file. js *** to get the php code that may be used by the extension functionget _
1. delay the request file to simulate the scenario where the network speed is not good. The Code address is as follows:
Https://gist.github.com/2650596
?
'Content-Type: application/x-javascript ', 'css' => 'Content-Type: text/css ', 'jpg' => 'Content-Type: image/jpg ', 'GIF' => 'Content-Type: image/GIF', 'PNG' => 'Content-Type: image/png ', 'jpeg '=> 'Content-Type: image/jpeg', 'swf '=> 'Content-Type: application/x-shockwave-Flash '); $ filename = $ _ GET ['F']; $ R_files = file ($ _ GET ['F']); if (empty ($ type )) {$ type = get_extend ($ filename);} header ($ header [$ type]) ; Ob_flush (); flush (); sleep ($ _ GET ['t']); // var_dump ($ R_files); echo join ("\ n ", $ R_files);?>
? Applicable methods:
Put the code in the PHP file under the Project Directory. when referencing the target file, the method is as follows:
Http: // cdn/your directory/delay. php? F = yourfile. js & t = 100.
? 2. the page logic is suspended and continues after a while.
ob_flush();flush();sleep($_GET['t']);
? Sleep is a built-in function of php. the parameter is time, in seconds. it should be placed in a file with the PHP suffix, or configured to be used in a js file, or added after the js suffix. php, such as xxx. js. php
?