Home > Backend Development > PHP Tutorial > PHP Session Optimization Source Code_PHP Tutorial

PHP Session Optimization Source Code_PHP Tutorial

WBOY
Release: 2016-07-13 10:21:46
Original
857 people have browsed it

PHP Session optimization source code

The server SESSION of PHP does not end when the same client requests it, and the next request cannot be made!

For example, the following code:

client:















server:

session_start();
sleep(2);
echo '{json:"repsonse ' . $_GET["call"] . '"}';
?>

The above client takes more than 10 seconds to load.

After using SESSION, you can use session_write_close(); to close it, and the next request can be executed immediately!

Example:

session_start();
session_write_close();
sleep(2);
echo '{json:"repsonse ' . $_GET["call"] . '"}';
?>

The client loading time of the above code is reduced from 10s to 2s!

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/853762.htmlTechArticlePHP Session optimization source code PHP SESSION The server SESSION does not end when the same client requests, and the next request cannot be made! For example, the following code: client: html head meta http-equiv=Content-Ty...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template