Or the php code used

Source: Internet
Author: User
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

?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.