ASP Buffer ÊôÐÔ

response ¶ÔÏó²Î¿¼ÊÖ²á

Buffer ÊôÐԿɹ涨ÊÇ·ñ¶ÔÊä³ö½øÐлº³å¡£Í¨³£Çé¿öÏ£¬ASP ½Å±¾ÔÚ·þÎñÆ÷¶ËÖ´ÐУ¬Ã¿¾äµÄÖ´Ðнá¹û¶¼»á·¢Ë͵½¿Í»§¶ËµÄä¯ÀÀÆ÷ÉÏÏÔʾ³öÀ´¡£µ±Êä³öÉèÖûº´æÊ±£¬·þÎñÆ÷»á×èÖ¹Ïòä¯ÀÀÆ÷µÄÏìÓ¦£¬Ö±µ½ËùÓеķþÎñÆ÷½Å±¾¾ù±»´¦Àí£¬»òÕßÖ±µ½½Å±¾µ÷ÓÃÁË Flush »ò End ·½·¨¡£

×¢ÊÍ£ºÈç¹ûÒªÉèÖôËÊôÐÔ£¬ËüÓ¦µ±Î»ÓÚ .asp ÎļþÖÐµÄ <html> ±êǩ֮ǰ¡£

Óï·¨£º

response.Buffer[=flag]
²ÎÊý ÃèÊö
flag

²¼¶ûÖµ£¬¹æ¶¨ÊÇ·ñ»º³åÒ³ÃæÊä³ö¡£

False ָʾ²»»º´æ£¬·þÎñÆ÷»áÒ»±ß´¦ÀíÒ»±ß·¢ËÍÊä³ö¡£IIS version 4.0 ĬÈÏΪ False£¬¶ø IIS version 5.0 ¼°¸ü¸ßµÄ°æ±¾Ä¬ÈÏΪ true¡£

True ָʾ»º³å¡£·þÎñÆ÷²»»á·¢ËÍÊä³ö£¬Ö±µ½Ò³ÃæÉϵÄËùÓнű¾±»´¦Àí£¬»òÕßÖ±µ½ Flush »ò End ·½·¨±»µ÷Óá£

ʵÀý

Àý×Ó 1

ÔÚÕâ¸öÀý×ÓÖУ¬ÔÚÑ­»·½áÊøÇ°²»»á±»ä¯ÀÀÆ÷·¢ËÍÊä³ö¡£Èç¹û buffer ±»ÉèÖÃΪ False £¬»áÿѭ»·Ò»´Î¾ÍÏòä¯ÀÀÆ÷Êä³öÒ»ÐС£

<%response.Buffer=true%>
<html>
<body>
<%
for i=1 to 100 
  response.write(i & "<br />")
next
%>
</body>
</html>

Àý×Ó 2

<%response.Buffer=true%>
<html>
<body>
<p>I write some text, but I will control when
the text will be sent to the browser.</p>
<p>The text is not sent yet. I hold it back!</p>
<p>OK, let it go!</p>
<%response.Flush%>
</body>
</html>

Àý×Ó 3

<%response.Buffer=true%>
<html>
<body>
<p>This is some text I want to send to the user.</p>
<p>No, I changed my mind. I want to clear the text.</p>
<%response.Clear%>
</body>
</html>

response ¶ÔÏó²Î¿¼ÊÖ²á

VUE