第17页
- 页码:第17页
test9.php
<?php ?> <!DOCTYPE HTML> <html> <body> <pre id='x'>init</pre> <script src="http://libs.baidu.com/jquery/1.9.1/jquery.min.js"></script> <script> var es = new EventSource('test8.php'); es.addEventListener('message',function(e){ $('#x').append("\n" + e.data); },false) ; </script> </body> </html>test8.php
<?php header("Content-Type: text/event-stream"); while(true){ echo 'data:'.date('Y-m-d H:i:s')."\n\n"; @ob_flush();flush(); sleep(1); } ?>output: init 2016-03-28 15:33:11 2016-03-28 15:33:12 2016-03-28 15:33:13 2016-03-28 15:33:14 2016-03-28 15:33:15 2016-03-28 15:33:16 2016-03-28 15:33:17
22人阅读
对本书的所有笔记 · · · · · ·
-
第17页
-
第96页
<?php header('Content-Type: text/plain'); if(array_key_exists('HTTP_USER_AGENT',$_SE...
> 查看全部2篇
说明 · · · · · ·
表示其中内容是对原文的摘抄