mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-06-18 13:57:03 +08:00
103 lines
4.0 KiB
HTML
103 lines
4.0 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>从资源流里读取一行直到给定的定界符</title>
|
||
</head>
|
||
<body class="docs"><div id="layout">
|
||
<div id="layout-content"><div id="function.stream-get-line" class="refentry">
|
||
<div class="refnamediv">
|
||
<h1 class="refname">stream_get_line</h1>
|
||
<p class="verinfo">(PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">stream_get_line</span> — <span class="dc-title">从资源流里读取一行直到给定的定界符</span></p>
|
||
|
||
</div>
|
||
<div class="refsect1 description" id="refsect1-function.stream-get-line-description">
|
||
<h3 class="title">说明</h3>
|
||
<div class="methodsynopsis dc-description">
|
||
<span class="methodname"><strong>stream_get_line</strong></span>
|
||
( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$handle</code></span>
|
||
, <span class="methodparam"><span class="type">int</span> <code class="parameter">$length</code></span>
|
||
[, <span class="methodparam"><span class="type">string</span> <code class="parameter">$ending</code></span>
|
||
] ) : <span class="type">string</span></div>
|
||
|
||
<p class="para rdfs-comment">
|
||
从给定的资源流里读取一行。
|
||
</p>
|
||
<p class="para">
|
||
当读取到 <code class="parameter">length</code> 个字节数就结束,或者当在读取的字符串中发现 <code class="parameter">ending</code> (<em class="emphasis">不</em>包含到返回值里)也结束,又或者遇到了 <acronym title="End Of File">EOF</acronym> 也结束(总之以上条件中哪个先出现就以哪个为准)。
|
||
</p>
|
||
<p class="para">
|
||
这个函数与 <span class="function"><a href="fgets.html" class="function">fgets()</a></span> 几乎是相同的,唯一的区别是在这个函数里面允许指定行尾的定界符,而不是使用标准的 \n, \r 还有 \r\n ,并且返回值中<em class="emphasis">不</em>包含定界符。(翻译注:也可以把 \n 等作为定界符传入 <code class="parameter">ending</code> )
|
||
</p>
|
||
</div>
|
||
|
||
|
||
<div class="refsect1 parameters" id="refsect1-function.stream-get-line-parameters">
|
||
<h3 class="title">参数</h3>
|
||
<p class="para">
|
||
<dl>
|
||
|
||
|
||
<dt>
|
||
<code class="parameter">handle</code></dt>
|
||
|
||
<dd>
|
||
|
||
<p class="para">
|
||
一个有效的文件句柄。
|
||
</p>
|
||
</dd>
|
||
|
||
|
||
|
||
<dt>
|
||
<code class="parameter">length</code></dt>
|
||
|
||
<dd>
|
||
|
||
<p class="para">
|
||
需要从句柄里读取的字节数。
|
||
</p>
|
||
</dd>
|
||
|
||
|
||
|
||
<dt>
|
||
<code class="parameter">ending</code></dt>
|
||
|
||
<dd>
|
||
|
||
<p class="para">
|
||
可选参数,字符串定界符。
|
||
</p>
|
||
</dd>
|
||
|
||
|
||
</dl>
|
||
|
||
</p>
|
||
</div>
|
||
|
||
|
||
<div class="refsect1 returnvalues" id="refsect1-function.stream-get-line-returnvalues">
|
||
<h3 class="title">返回值</h3>
|
||
<p class="para">
|
||
返回一个字符串,该字符串的内容根据 <code class="parameter">length</code> 字节数从 <code class="parameter">handle</code> 里读取。
|
||
</p>
|
||
<p class="para">
|
||
如果发生错误,则返回 <strong><code>FALSE</code></strong>.
|
||
</p>
|
||
</div>
|
||
|
||
|
||
<div class="refsect1 seealso" id="refsect1-function.stream-get-line-seealso">
|
||
<h3 class="title">参见</h3>
|
||
<ul class="simplelist">
|
||
<li class="member"><span class="function"><a href="fread.html" class="function" rel="rdfs-seeAlso">fread()</a> - 读取文件(可安全用于二进制文件)</span></li>
|
||
<li class="member"><span class="function"><a href="fgets.html" class="function" rel="rdfs-seeAlso">fgets()</a> - 从文件指针中读取一行</span></li>
|
||
<li class="member"><span class="function"><a href="fgetc.html" class="function" rel="rdfs-seeAlso">fgetc()</a> - 从文件指针中读取字符</span></li>
|
||
</ul>
|
||
</div>
|
||
|
||
|
||
</div></div></div></body></html> |