📄 function.gzwrite.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head> <title>Binary-safe gz-file write</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.gzuncompress.html">gzuncompress</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.readgzfile.html">readgzfile</a></div> <div class="up"><a href="ref.zlib.html">Zlib Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div><hr /><div id="function.gzwrite" class="refentry"> <div class="refnamediv"> <h1 class="refname">gzwrite</h1> <p class="verinfo">(PHP 4, PHP 5)</p><p class="refpurpose"><span class="refname">gzwrite</span> — <span class="dc-title">Binary-safe gz-file write</span></p> </div> <div class="refsect1 description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type">int</span> <span class="methodname"><b><b>gzwrite</b></b></span> ( <span class="methodparam"><span class="type">resource</span> <tt class="parameter">$zp</tt></span> , <span class="methodparam"><span class="type">string</span> <tt class="parameter">$string</tt></span> [, <span class="methodparam"><span class="type">int</span> <tt class="parameter">$length</tt></span> ] )</div> <p class="para rdfs-comment"> <b>gzwrite()</b> writes the contents of <i><tt class="parameter">string</tt></i> to the given gz-file. </p> </div> <div class="refsect1 parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt> <span class="term"><i><tt class="parameter">zp</tt></i></span> <dd> <p class="para"> The gz-file pointer. It must be valid, and must point to a file successfully opened by <a href="function.gzopen.html" class="function">gzopen()</a>. </p> </dd> </dt> <dt> <span class="term"><i><tt class="parameter">string</tt></i></span> <dd> <p class="para"> The string to write. </p> </dd> </dt> <dt> <span class="term"><i><tt class="parameter">length</tt></i></span> <dd> <p class="para"> The number of uncompressed bytes to write. If supplied, writing will stop after <i><tt class="parameter">length</tt></i> (uncompressed) bytes have been written or the end of <i><tt class="parameter">string</tt></i> is reached, whichever comes first. </p> <blockquote><p><b class="note">Note</b>: Note that if the <i><tt class="parameter">length</tt></i> argument is given, then the <a href="info.configuration.html#ini.magic-quotes-runtime" class="link">magic_quotes_runtime</a> configuration option will be ignored and no slashes will be stripped from <i><tt class="parameter">string</tt></i>. <br /> </p></blockquote> </dd> </dt> </dl> </p> </div> <div class="refsect1 returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> Returns the number of (uncompressed) bytes written to the given gz-file stream. </p> </div> <div class="refsect1 examples"> <h3 class="title">Examples</h3> <p class="para"> <div class="example"> <p><b>Example #1 <b>gzwrite()</b> example</b></p> <div class="example-contents"><div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB"><?php<br />$string </span><span style="color: #007700">= </span><span style="color: #DD0000">'Some information to compress'</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$gz </span><span style="color: #007700">= </span><span style="color: #0000BB">gzopen</span><span style="color: #007700">(</span><span style="color: #DD0000">'somefile.gz'</span><span style="color: #007700">,</span><span style="color: #DD0000">'w9'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">gzwrite</span><span style="color: #007700">(</span><span style="color: #0000BB">$gz</span><span style="color: #007700">, </span><span style="color: #0000BB">$string</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">gzclose</span><span style="color: #007700">(</span><span style="color: #0000BB">$gz</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?></span></span></code></div> </div> </div> </p> </div> <div class="refsect1 seealso"> <h3 class="title">See Also</h3> <p class="para"> <ul class="simplelist"> <li class="member"><a href="function.gzread.html" class="function" rel="rdfs-seeAlso">gzread()</a></li> <li class="member"><a href="function.gzopen.html" class="function" rel="rdfs-seeAlso">gzopen()</a></li> </ul> </p> </div></div><hr /><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.gzuncompress.html">gzuncompress</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.readgzfile.html">readgzfile</a></div> <div class="up"><a href="ref.zlib.html">Zlib 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 + -