phpday 2027 - Call for Papers

StreamPollHandle::getStream

(PHP 8 >= 8.6.0)

StreamPollHandle::getStream — Returns the stream of the handle

说明

public function StreamPollHandle::getStream(): resource

Returns the stream that was passed to StreamPollHandle::__construct().

参数

此函数没有参数。

返回值

Returns the stream resource. If the stream was closed in the meantime, the returned value is a closed resource.

示例

示例 #1 StreamPollHandle::getStream() example

<?php
[$reader, $writer] = stream_socket_pair(STREAM_PF_UNIX, STREAM_SOCK_STREAM, STREAM_IPPROTO_IP);

$handle = new StreamPollHandle($reader);
var_dump($handle->getStream() === $reader);

fclose($reader);
var_dump(is_resource($handle->getStream()));

以上示例会输出:

bool(true)
bool(false)

参见

+添加备注

用户贡献的备注

此页面尚无用户贡献的备注。
To Top