當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。