本文整理匯總了PHP中Psr\Http\Message\StreamInterface::close方法的典型用法代碼示例。如果您正苦於以下問題:PHP StreamInterface::close方法的具體用法?PHP StreamInterface::close怎麽用?PHP StreamInterface::close使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Psr\Http\Message\StreamInterface
的用法示例。
在下文中一共展示了StreamInterface::close方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: send
/**
* Sends response to output.
* @param IRequest $request
* @param IResponse $response
*/
public function send(IRequest $request, IResponse $response)
{
// Set response headers for the file download
$response->setHeader('Content-Length', $this->stream->getSize());
$response->setHeader('Content-Type', $this->contentType);
$response->setHeader('Content-Disposition', 'attachment; filename="' . $this->name . '";');
while (!$this->stream->eof()) {
echo $this->stream->read(4000000.0);
}
$this->stream->close();
}
示例2: close
/**
* {@inheritdoc}
*/
public function close()
{
if ($this->stream !== NULL) {
try {
if ($this->closeCascade) {
$this->stream->close();
}
} finally {
$this->stream = NULL;
}
}
}
示例3: close
/**
* {@inheritdoc}
*/
public function close($closeStream = false)
{
if (self::STATE_FIRST_ELEMENT != ($this->state | self::STATE_FIRST_ELEMENT)) {
throw new JsonSerializationException('JSON syntax error, unfinished array or object detected', self::ERROR_GENERIC);
}
if ($closeStream) {
$this->stream->close();
}
}
示例4: wrapBodyStream
/**
* @param StreamInterface $stream
* @return StreamInterface
*/
private static function wrapBodyStream(StreamInterface $stream)
{
$eofStream = false;
$methods = ['close' => function () use($stream, &$eofStream) {
$stream->close();
$eofStream = true;
}, 'eof' => function () use($stream, &$eofStream) {
return $eofStream || $stream->eof();
}];
//\GuzzleHttp\Stream\FnStream::decorate($stream, $methods);
return \GuzzleHttp\Psr7\FnStream::decorate($stream, $methods);
}
示例5: close
/**
* {@inheritdoc}
*/
public function close()
{
$this->stream->close();
}
示例6: close
/**
* {@inheritdoc}
*/
public function close()
{
$this->decoratedStream->close();
}
示例7: close
public function close()
{
return $this->stream->close();
}
示例8: testCloses
public function testCloses()
{
$this->b->close();
$this->assertFalse(is_resource($this->c));
}