mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-06-18 05:26:57 +08:00
98 lines
4.4 KiB
HTML
98 lines
4.4 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>Get line from file pointer</title>
|
|
</head>
|
|
<body class="docs"><div id="layout">
|
|
<div id="layout-content"><div id="function.gzgets" class="refentry">
|
|
<div class="refnamediv">
|
|
<h1 class="refname">gzgets</h1>
|
|
<p class="verinfo">(PHP 4, PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">gzgets</span> — <span class="dc-title">Get line from file pointer</span></p>
|
|
|
|
</div>
|
|
<div class="refsect1 description" id="refsect1-function.gzgets-description">
|
|
<h3 class="title">说明</h3>
|
|
<div class="methodsynopsis dc-description">
|
|
<span class="methodname"><strong>gzgets</strong></span>
|
|
( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$zp</code></span>
|
|
[, <span class="methodparam"><span class="type">int</span> <code class="parameter">$length</code></span>
|
|
] ) : <span class="type">string</span></div>
|
|
|
|
<p class="para rdfs-comment">
|
|
Gets a (uncompressed) string of up to length - 1 bytes read from the given
|
|
file pointer. Reading ends when length - 1 bytes have been read, on a
|
|
newline, or on EOF (whichever comes first).
|
|
</p>
|
|
</div>
|
|
|
|
<div class="refsect1 parameters" id="refsect1-function.gzgets-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">length</code></dt>
|
|
|
|
<dd>
|
|
|
|
<p class="para">
|
|
The length of data to get.
|
|
</p>
|
|
</dd>
|
|
|
|
|
|
</dl>
|
|
|
|
</p>
|
|
</div>
|
|
|
|
<div class="refsect1 returnvalues" id="refsect1-function.gzgets-returnvalues">
|
|
<h3 class="title">返回值</h3>
|
|
<p class="para">
|
|
The uncompressed string, or <strong><code>FALSE</code></strong> on error.
|
|
</p>
|
|
</div>
|
|
|
|
<div class="refsect1 examples" id="refsect1-function.gzgets-examples">
|
|
<h3 class="title">范例</h3>
|
|
<p class="para">
|
|
<div class="example" id="example-875">
|
|
<p><strong>Example #1 <span class="function"><strong>gzgets()</strong></span> example</strong></p>
|
|
<div class="example-contents">
|
|
<div class="phpcode"><pre><span style="color: #000000">
|
|
<span style="color: #0000BB"><?php<br />$handle </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">'r'</span><span style="color: #007700">);<br />while (!</span><span style="color: #0000BB">gzeof</span><span style="color: #007700">(</span><span style="color: #0000BB">$handle</span><span style="color: #007700">)) {<br /> </span><span style="color: #0000BB">$buffer </span><span style="color: #007700">= </span><span style="color: #0000BB">gzgets</span><span style="color: #007700">(</span><span style="color: #0000BB">$handle</span><span style="color: #007700">, </span><span style="color: #0000BB">4096</span><span style="color: #007700">);<br /> echo </span><span style="color: #0000BB">$buffer</span><span style="color: #007700">;<br />}<br /></span><span style="color: #0000BB">gzclose</span><span style="color: #007700">(</span><span style="color: #0000BB">$handle</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?></span>
|
|
</span>
|
|
</pre></div>
|
|
</div>
|
|
|
|
</div>
|
|
</p>
|
|
</div>
|
|
|
|
<div class="refsect1 seealso" id="refsect1-function.gzgets-seealso">
|
|
<h3 class="title">参见</h3>
|
|
<p class="para">
|
|
<ul class="simplelist">
|
|
<li class="member"><span class="function"><a href="gzopen.html" class="function" rel="rdfs-seeAlso">gzopen()</a> - Open gz-file</span></li>
|
|
<li class="member"><span class="function"><a href="gzgetc.html" class="function" rel="rdfs-seeAlso">gzgetc()</a> - Get character from gz-file pointer</span></li>
|
|
<li class="member"><span class="function"><a href="gzwrite.html" class="function" rel="rdfs-seeAlso">gzwrite()</a> - Binary-safe gz-file write</span></li>
|
|
</ul>
|
|
</p>
|
|
</div>
|
|
|
|
</div></div></div></body></html> |