Created
July 25, 2011 09:57
-
-
Save fundon/1103850 to your computer and use it in GitHub Desktop.
BigPipe php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* http://www.justincarmony.com/blog/2011/01/24/php-nginx-and-output-flushing/ | |
* http://huoding.com/2011/06/26/88 | |
* http://www.infoq.com/cn/news/2010/08/bigpipe-facebook-optimize | |
* http://www.subbu.org/blog/2010/07/bigpipe-done-in-node-js | |
* nginx fail! | |
* apache success! | |
*/ | |
sleep(1); | |
$header = 'header'; | |
sleep(1); | |
$content = 'content'; | |
sleep(1); | |
$footer = 'footer'; | |
?> | |
<html> | |
<head> | |
<title>test</title> | |
</head> | |
<body> | |
<div id="header"><?php echo $header; ?></div> | |
<div id="content"><?php echo $content; ?></div> | |
<div id="footer"><?php echo $footer; ?></div> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>test</title> | |
</head> | |
<body> | |
<?php sleep(1); ?> | |
<div id="header"><?php echo str_pad('header', 1024); ?></div> | |
<?php ob_flush(); flush(); ?> | |
<?php sleep(1); ?> | |
<div id="content"><?php echo str_pad('content', 1024); ?></div> | |
<?php ob_flush(); flush(); ?> | |
<?php sleep(1); ?> | |
<div id="footer"><?php echo str_pad('footer', 1024); ?></div> | |
<?php ob_flush(); flush(); ?> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>test</title> | |
</head> | |
<body> | |
<div id="header"></div> | |
<div id="content"></div> | |
<div id="footer"></div> | |
<?php ob_flush(); flush(); ?> | |
<?php sleep(1); $header = str_pad('header', 1024); ?> | |
<script> | |
document.getElementById("header").innerHTML = "<?php echo $header; ?>"; | |
</script> | |
<?php ob_flush(); flush(); ?> | |
<?php sleep(1); $content = str_pad('content', 1024); ?> | |
<script> | |
document.getElementById("content").innerHTML = "<?php echo $content; ?>"; | |
</script> | |
<?php ob_flush(); flush(); ?> | |
<?php sleep(1); $footer = str_pad('footer', 1024); ?> | |
<script> | |
document.getElementById("footer").innerHTML = "<?php echo $footer; ?>"; | |
</script> | |
<?php ob_flush(); flush(); ?> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment