array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'zh', ), 'this' => array ( 0 => 'function.stream-filter-remove.php', 1 => 'stream_filter_remove', ), 'up' => array ( 0 => 'ref.stream.php', 1 => 'Stream 函数', ), 'prev' => array ( 0 => 'function.stream-filter-register.php', 1 => 'stream_filter_register', ), 'next' => array ( 0 => 'function.stream-get-contents.php', 1 => 'stream_get_contents', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'zh', 'path' => 'reference/stream/functions/stream-filter-remove.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
stream_filter_remove — 从资源流里移除某个过滤器
移除之前通过 stream_filter_prepend() 或者 stream_filter_append() 添加到资源流里面的过滤器。 在移除之前,残留在过滤器内部缓冲区里的所有数据刷新到下一个过滤器。
stream_filter
需要被移除的资源流过滤器。
示例 #1 动态地重新过滤一个资源流
<?php
/* 打开测试文件进行读写 */
$fp = fopen("test.txt", "rw");
$rot13_filter = stream_filter_append($fp, "string.rot13", STREAM_FILTER_WRITE);
fwrite($fp, "This is ");
stream_filter_remove($rot13_filter);
fwrite($fp, "a test\n");
rewind($fp);
fpassthru($fp);
fclose($fp);
?>
以上示例会输出:
Guvf vf a test