作者 邓超

1

@@ -16,32 +16,11 @@ class Test { @@ -16,32 +16,11 @@ class Test {
16 16
17 17
18 public function home(){ 18 public function home(){
19 - ob_start();  
20 - header("Content-Type:text/event-stream;Charset=UTF-8;\n\n");  
21 - header("cache-control:no-cache;\n\n");  
22 -  
23 -  
24 - foreach (range(1,10) as $i)  
25 -  
26 - {  
27 -  
28 - echo $i.'hello world'.PHP_EOL.PHP_EOL ;  
29 -  
30 - ob_flush();  
31 -  
32 - flush();  
33 -  
34 -  
35 - sleep(1);  
36 19
37 } 20 }
38 21
39 - ob_clean();  
40 - }  
41 -  
42 public function a(){ 22 public function a(){
43 - header("Content-Type:text/html;Charset=UTF-8;");  
44 - echo '1'; 23 +
45 } 24 }
46 25
47 26
@@ -6,12 +6,7 @@ @@ -6,12 +6,7 @@
6 */ 6 */
7 return [ 7 return [
8 8
9 - /**  
10 - * home  
11 - * @see \Controller\Test::a()  
12 - */  
13 - '/' => [\Controller\Test::class, 'a'],  
14 - 't' => [\Controller\Test::class, 'home'], 9 + '/' => [\Controller\Test::class, 'home'],
15 10
16 // 登录操作 11 // 登录操作
17 'login' => [\Controller\Login::class, 'login'], 12 'login' => [\Controller\Login::class, 'login'],