当前位置: 首页>>代码示例>>PHP>>正文


PHP StreamInterface::close方法代码示例

本文整理汇总了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();
 }
开发者ID:ublaboo,项目名称:responses,代码行数:16,代码来源:PSR7StreamResponse.php

示例2: close

 /**
  * {@inheritdoc}
  */
 public function close()
 {
     if ($this->stream !== NULL) {
         try {
             if ($this->closeCascade) {
                 $this->stream->close();
             }
         } finally {
             $this->stream = NULL;
         }
     }
 }
开发者ID:koolkode,项目名称:stream,代码行数:15,代码来源:AbstractInputStream.php

示例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();
     }
 }
开发者ID:koolkode,项目名称:json,代码行数:12,代码来源:JsonStreamWriter.php

示例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);
 }
开发者ID:chazer,项目名称:json-stream-reader,代码行数:16,代码来源:GuzzleStreamReader.php

示例5: close

 /**
  * {@inheritdoc}
  */
 public function close()
 {
     $this->stream->close();
 }
开发者ID:narrowspark,项目名称:framework,代码行数:7,代码来源:AbstractStreamDecorator.php

示例6: close

 /**
  * {@inheritdoc}
  */
 public function close()
 {
     $this->decoratedStream->close();
 }
开发者ID:zendframework,项目名称:zend-diactoros,代码行数:7,代码来源:RelativeStream.php

示例7: close

 public function close()
 {
     return $this->stream->close();
 }
开发者ID:Hikariii,项目名称:php-box-view,代码行数:4,代码来源:AbstractDecoratorStream.php

示例8: testCloses

 public function testCloses()
 {
     $this->b->close();
     $this->assertFalse(is_resource($this->c));
 }
开发者ID:nystudio107,项目名称:instantanalytics,代码行数:5,代码来源:StreamDecoratorTraitTest.php


注:本文中的Psr\Http\Message\StreamInterface::close方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。