uTools-Manuals/docs/php/stream_set_blocking.html
2019-04-28 19:00:34 +08:00

123 lines
4.3 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!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-set-blocking" class="refentry">
<div class="refnamediv">
<h1 class="refname">stream_set_blocking</h1>
<p class="verinfo">(PHP 4 &gt;= 4.3.0, PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">stream_set_blocking</span> &mdash; <span class="dc-title">为资源流设置阻塞或者阻塞模式</span></p>
</div>
<div class="refsect1 description" id="refsect1-function.stream-set-blocking-description">
<h3 class="title">说明</h3>
<div class="methodsynopsis dc-description">
<span class="methodname"><strong>stream_set_blocking</strong></span>
( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$stream</code></span>
, <span class="methodparam"><span class="type">int</span> <code class="parameter">$mode</code></span>
) : <span class="type">bool</span></div>
<p class="para rdfs-comment">
<code class="parameter">stream</code> 设置阻塞或者阻塞模。
</p>
<p class="para">
此函数适用于支持非阻塞模式的任何资源流(常规文件,套接字资源流等)。
</p>
</div>
<div class="refsect1 parameters" id="refsect1-function.stream-set-blocking-parameters">
<h3 class="title">参数</h3>
<p class="para">
<dl>
<dt>
<code class="parameter">stream</code></dt>
<dd>
<p class="para">
资源流。
</p>
</dd>
<dt>
<code class="parameter">mode</code></dt>
<dd>
<p class="para">
如果 <code class="parameter">mode</code> 为0资源流将会被转换为非阻塞模式如果是1资源流将会被转换为阻塞模式。
该参数的设置将会影响到像 <span class="function"><a href="fgets.html" class="function">fgets()</a></span><span class="function"><a href="fread.html" class="function">fread()</a></span> 这样的函数从资源流里读取数据。
在非阻塞模式下,调用 <span class="function"><a href="fgets.html" class="function">fgets()</a></span> 总是会立即返回;而在阻塞模式下,将会一直等到从资源流里面获取到数据才能返回。
</p>
</dd>
</dl>
</p>
</div>
<div class="refsect1 returnvalues" id="refsect1-function.stream-set-blocking-returnvalues">
<h3 class="title">返回值</h3>
<p class="para">
成功时返回 <strong><code>TRUE</code></strong> 或者在失败时返回 <strong><code>FALSE</code></strong>
</p>
</div>
<div class="refsect1 changelog" id="refsect1-function.stream-set-blocking-changelog">
<h3 class="title">更新日志</h3>
<p class="para">
<table class="doctable informaltable">
<thead>
<tr>
<th>版本</th>
<th>说明</th>
</tr>
</thead>
<tbody class="tbody">
<tr>
<td>4.3.0</td>
<td>
在PHP 4.3.0之前,该函数只支持套接字资源流。
</td>
</tr>
</tbody>
</table>
</p>
</div>
<div class="refsect1 notes" id="refsect1-function.stream-set-blocking-notes">
<h3 class="title">注释</h3>
<blockquote class="note"><p><strong class="note">Note</strong>:
<p class="para">
该函数之前叫作 <span class="function"><a href="set_socket_blocking.html" class="function">set_socket_blocking()</a></span> 后来又叫做 <span class="function"><a href="socket_set_blocking.html" class="function">socket_set_blocking()</a></span> ,但是这种用法都已经被废弃。
</p>
</p></blockquote>
</div>
<div class="refsect1 seealso" id="refsect1-function.stream-set-blocking-seealso">
<h3 class="title">参见</h3>
<ul class="simplelist">
<li class="member"><span class="function"><a href="stream_select.html" class="function" rel="rdfs-seeAlso">stream_select()</a> - Runs the equivalent of the select() system call on the given
arrays of streams with a timeout specified by tv_sec and tv_usec</span></li>
</ul>
</div>
</div></div></div></body></html>