作者 邓超

1

... ... @@ -16,32 +16,11 @@ class Test {
public function home(){
ob_start();
header("Content-Type:text/event-stream;Charset=UTF-8;\n\n");
header("cache-control:no-cache;\n\n");
foreach (range(1,10) as $i)
{
echo $i.'hello world'.PHP_EOL.PHP_EOL ;
ob_flush();
flush();
sleep(1);
}
ob_clean();
}
public function a(){
header("Content-Type:text/html;Charset=UTF-8;");
echo '1';
}
... ...
... ... @@ -6,12 +6,7 @@
*/
return [
/**
* home
* @see \Controller\Test::a()
*/
'/' => [\Controller\Test::class, 'a'],
't' => [\Controller\Test::class, 'home'],
'/' => [\Controller\Test::class, 'home'],
// 登录操作
'login' => [\Controller\Login::class, 'login'],
... ...