uTools-Manuals/docs/php/gzwrite.html
2019-04-08 23:22:26 +08:00

121 lines
4.9 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Binary-safe gz-file write</title>
</head>
<body class="docs"><div id="layout">
<div id="layout-content"><div id="function.gzwrite" class="refentry">
<div class="refnamediv">
<h1 class="refname">gzwrite</h1>
<p class="verinfo">(PHP 4, PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">gzwrite</span> &mdash; <span class="dc-title">Binary-safe gz-file write</span></p>
</div>
<div class="refsect1 description" id="refsect1-function.gzwrite-description">
<h3 class="title">说明</h3>
<div class="methodsynopsis dc-description">
<span class="methodname"><strong>gzwrite</strong></span>
( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$zp</code></span>
, <span class="methodparam"><span class="type">string</span> <code class="parameter">$string</code></span>
[, <span class="methodparam"><span class="type">int</span> <code class="parameter">$length</code></span>
] ) : <span class="type">int</span></div>
<p class="para rdfs-comment">
<span class="function"><strong>gzwrite()</strong></span> writes the contents of
<code class="parameter">string</code> to the given gz-file.
</p>
</div>
<div class="refsect1 parameters" id="refsect1-function.gzwrite-parameters">
<h3 class="title">参数</h3>
<p class="para">
<dl>
<dt>
<code class="parameter">zp</code></dt>
<dd>
<p class="para">
The gz-file pointer. It must be valid, and must point to a file
successfully opened by <span class="function"><a href="gzopen.html" class="function">gzopen()</a></span>.
</p>
</dd>
<dt>
<code class="parameter">string</code></dt>
<dd>
<p class="para">
The string to write.
</p>
</dd>
<dt>
<code class="parameter">length</code></dt>
<dd>
<p class="para">
The number of uncompressed bytes to write. If supplied, writing will
stop after <code class="parameter">length</code> (uncompressed) bytes have been
written or the end of <code class="parameter">string</code> is reached,
whichever comes first.
</p>
<blockquote class="note"><p><strong class="note">Note</strong>:
<p class="para">
Note that if the <code class="parameter">length</code> 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 <code class="parameter">string</code>.
</p>
</p></blockquote>
</dd>
</dl>
</p>
</div>
<div class="refsect1 returnvalues" id="refsect1-function.gzwrite-returnvalues">
<h3 class="title">返回值</h3>
<p class="para">
Returns the number of (uncompressed) bytes written to the given gz-file
stream.
</p>
</div>
<div class="refsect1 examples" id="refsect1-function.gzwrite-examples">
<h3 class="title">范例</h3>
<p class="para">
<div class="example" id="example-883">
<p><strong>Example #1 <span class="function"><strong>gzwrite()</strong></span> example</strong></p>
<div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$string&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'Some&nbsp;information&nbsp;to&nbsp;compress'</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$gz&nbsp;</span><span style="color: #007700">=&nbsp;</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">,&nbsp;</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">?&gt;</span>
</span>
</pre></div>
</div>
</div>
</p>
</div>
<div class="refsect1 seealso" id="refsect1-function.gzwrite-seealso">
<h3 class="title">参见</h3>
<p class="para">
<ul class="simplelist">
<li class="member"><span class="function"><a href="gzread.html" class="function" rel="rdfs-seeAlso">gzread()</a> - Binary-safe gz-file read</span></li>
<li class="member"><span class="function"><a href="gzopen.html" class="function" rel="rdfs-seeAlso">gzopen()</a> - Open gz-file</span></li>
</ul>
</p>
</div>
</div></div></div></body></html>