- 主题:如何让服务器在连接关闭前返回response?
是什么原理?
<?php
echo("Hi! Have a random number: " . rand(1,10));
sleep(20);
用上面这段试了一下,发现必须在20秒之后才能得到响应
--
FROM 218.242.223.*
flush..
【 在 BiYeSeng (毕业僧) 的大作中提到: 】
: 是什么原理?
: <?php
: echo("Hi! Have a random number: " . rand(1,10));
: ...................
--
FROM 61.135.255.83
没用吧?
经测试,确实无效
flush() has no effect on the buffering scheme of your webserver or the browser on the client side.
Several servers, especially on Win32, will still buffer the output from your script until it terminates before transmitting the results to the browser.
Server modules for Apache like mod_gzip may do buffering of their own that will cause flush() to not result in data being sent immediately to the client.
Even the browser may buffer its input before displaying it. Netscape, for example, buffers text until it receives an end-of-line or the beginning of a tag, and it won't render tables until the </table> tag of the outermost table is seen.
Some versions of Microsoft Internet Explorer will only start to display the page after they have received 256 bytes of output, so you may need to send extra whitespace before flushing to get those browsers to display the page.
【 在 sly9 (= =b) 的大作中提到: 】
: flush..
--
修改:BiYeSeng FROM 218.242.223.*
FROM 218.242.223.*
谁让php只是个脚本引擎呢...
【 在 BiYeSeng (毕业僧) 的大作中提到: 】
: 没用吧?
: 经测试,确实无效
: flush() has no effect on the buffering scheme of your webserver or the browser on the client side.
: ...................
--
FROM 202.106.68.*
所有脚本都不行?
【 在 sayinger (言者) 的大作中提到: 】
: 谁让php只是个脚本引擎呢...
--
FROM 218.242.223.*
所有的都不行
【 在 BiYeSeng (毕业僧) 的大作中提到: 】
: 所有脚本都不行?
--
FROM 202.108.130.*
那倒不一定,或许准确的说是,谁让php被认为是一个脚本引擎呢...
【 在 BiYeSeng (毕业僧) 的大作中提到: 】
: 所有脚本都不行?
--
FROM 202.106.68.*
搜索: Transfer-Encoding chunked
【 在 BiYeSeng (毕业僧) 的大作中提到: 】
: 是什么原理?
: <?php
: echo("Hi! Have a random number: " . rand(1,10));
: ...................
--
FROM 119.42.238.*