📄 function.stream-filter-remove.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head> <title>Remove a filter from a stream</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> </head> <body><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.stream-filter-register.html">stream_filter_register</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.stream-get-contents.html">stream_get_contents</a></div> <div class="up"><a href="ref.stream.html">Stream Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div><hr /><div id="function.stream-filter-remove" class="refentry"> <div class="refnamediv"> <h1 class="refname">stream_filter_remove</h1> <p class="verinfo">(PHP 5 >= 5.1.0)</p><p class="refpurpose"><span class="refname">stream_filter_remove</span> — <span class="dc-title">Remove a filter from a stream</span></p> </div> <div class="refsect1 unknown"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type">bool</span> <span class="methodname"><b><b>stream_filter_remove</b></b></span> ( <span class="methodparam"><span class="type">resource</span> <tt class="parameter">$stream_filter</tt></span> )</div> <p class="simpara"> Removes a stream filter previously added to a stream with <a href="function.stream-filter-prepend.html" class="function">stream_filter_prepend()</a> or <a href="function.stream-filter-append.html" class="function">stream_filter_append()</a>. Any data remaining in the filter's internal buffer will be flushed through to the next filter before removing it. </p> <p class="para"> <div class="example"> <p><b>Example #1 Dynamicly refiltering a stream</b></p> <div class="example-contents"><div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB"><?php<br /></span><span style="color: #FF8000">/* Open a test file for reading and writing */<br /></span><span style="color: #0000BB">$fp </span><span style="color: #007700">= </span><span style="color: #0000BB">fopen</span><span style="color: #007700">(</span><span style="color: #DD0000">"test.txt"</span><span style="color: #007700">, </span><span style="color: #DD0000">"rw"</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$rot13_filter </span><span style="color: #007700">= </span><span style="color: #0000BB">stream_filter_append</span><span style="color: #007700">(</span><span style="color: #0000BB">$fp</span><span style="color: #007700">, </span><span style="color: #DD0000">"string.rot13"</span><span style="color: #007700">, </span><span style="color: #0000BB">STREAM_FILTER_WRITE</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">fwrite</span><span style="color: #007700">(</span><span style="color: #0000BB">$fp</span><span style="color: #007700">, </span><span style="color: #DD0000">"This is "</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">stream_filter_remove</span><span style="color: #007700">(</span><span style="color: #0000BB">$rot13_filter</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">fwrite</span><span style="color: #007700">(</span><span style="color: #0000BB">$fp</span><span style="color: #007700">, </span><span style="color: #DD0000">"a test\n"</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">rewind</span><span style="color: #007700">(</span><span style="color: #0000BB">$fp</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">fpassthru</span><span style="color: #007700">(</span><span style="color: #0000BB">$fp</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">fclose</span><span style="color: #007700">(</span><span style="color: #0000BB">$fp</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">/* Expected Output<br /> ---------------<br /><br />Guvf vf a test<br /><br /> */<br /></span><span style="color: #0000BB">?></span></span></code></div> </div> </div> </p> <p class="simpara"> See also <a href="function.stream-filter-register.html" class="function">stream_filter_register()</a>, <a href="function.stream-filter-append.html" class="function">stream_filter_append()</a>, and <a href="function.stream-filter-prepend.html" class="function">stream_filter_prepend()</a>. </p> </div></div><hr /><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.stream-filter-register.html">stream_filter_register</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.stream-get-contents.html">stream_get_contents</a></div> <div class="up"><a href="ref.stream.html">Stream Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -