PHP session the same client request when the server sessions do not end, the next request cannot be done!
For example, the following code:
Client
<meta http-equiv= "Content-type" content= "text/html; charset=utf-8"/>
<meta name= "viewport" content= "Width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
<meta name= "apple-mobile-web-app-capable" content= "yes"/>
<meta name= " Apple-mobile-web-app-status-bar-style "content=" Black "/>
<meta name=" format-detection "content=" Telephone=no "/>
<script type=" Text/javascript "src= ' # '"/jquery-1.7.2.min.js "></SCRIPT>
< Style>
#content {
width:100%;
height:100%;
Text-align:center;
}
</style>
<body style= "margin:0; padding:0;"
<script type= "Text/javascript"
$ (document). Ready (function () {
for (var i = 1; I <= 5; i++) {
$.ajax ({
URL: "rest.php?call=" + I,
success:function (data) {
var id = i;
$ ("Body"). Append ("<p>call c Omplete "+ Data +" <p> ");
}
});
}
});
</script>
</body>
Server
<?php
Session_Start ();
Sleep (2);
Echo ' {json: ' repsonse '. $_get["Call"]. '"}';
?>
The above client load takes more than 10S of time.
Session can be used Session_write_close (), close, the next request can be executed immediately!
Cases:
<?php
Session_Start ();
Session_write_close ();
Sleep (2);
Echo ' {json: ' repsonse '. $_get["Call"]. '"}';
?>
The above code client load time reduced from 10s to 2s time!