PHP输出缓冲

<?php
ob_start();
?>
<form  action="<?php echo htmlspecialchars($_SERVER['PHP_SELF']);?>?login=1" method="post">
  <table>
    <tr>
      <td><label for="username"> Username </label></td>
      <td><input type="text" name="username" id="username" /></td>
    </tr><tr>
      <td><label for="password"> Password </label></td>
      <td><input type="password" name="password" id="password" /></td>
    </tr><tr>
      <td></td>
      <td><input type="submit" value="Log In" name="submit"/></td>
    </tr>
  </table>
</form>
<?php
ob_end_flush();
echo 'ob_get_length()函数返回当前的缓冲内容的长度是:'.ob_get_length().'字节<br />';
echo 'ob_get_contents()函数获得当前缓冲内容的是:<pre>'.htmlspecialchars(ob_get_contents()).'</pre><br />';

?>
posted @ 2010-11-02 12:39  nodot  阅读(263)  评论(0)    收藏  举报