PHP 8.3.4 Released!

stream_filter_remove

(PHP 5 >= 5.1.0, PHP 7, PHP 8)

stream_filter_remove从资源流里移除某个过滤器

说明

stream_filter_remove(resource $stream_filter): bool

移除之前通过 stream_filter_prepend() 或者 stream_filter_append() 添加到资源流里面的过滤器。 在移除之前,残留在过滤器内部缓冲区里的所有数据刷新到下一个过滤器。

参数

stream_filter

需要被移除的资源流过滤器。

返回值

成功时返回 true, 或者在失败时返回 false

示例

示例 #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

参见

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top