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


PHP Stream::close方法代码示例

本文整理汇总了PHP中Stream::close方法的典型用法代码示例。如果您正苦于以下问题:PHP Stream::close方法的具体用法?PHP Stream::close怎么用?PHP Stream::close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Stream的用法示例。


在下文中一共展示了Stream::close方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: close

 function close($client_id)
 {
     Stream::close($this->client_sock[$client_id]);
     $this->client_sock[$client_id] = null;
     unset($this->client_sock[$client_id]);
     $this->protocol->onClose($this, $client_id, 0);
 }
开发者ID:kilmas,项目名称:framework,代码行数:7,代码来源:BlockTCP.php

示例2: close

 public function close()
 {
     if ($this->stream && is_resource($this->stream)) {
         fclose($this->stream);
     }
     parent::close();
 }
开发者ID:locphp,项目名称:rsf,代码行数:7,代码来源:ResourceStream.php

示例3: get_contents

 public function get_contents()
 {
     $data = 'Test';
     $f = new Stream();
     $f->open(STREAM_MODE_WRITE);
     $f->write($data);
     $f->close();
     $this->assertEquals($data, FileUtil::getContents($f));
 }
开发者ID:Gamepay,项目名称:xp-framework,代码行数:9,代码来源:FileUtilTest.class.php

示例4: archiveBytesAsStream

 /**
  * Returns 
  *
  * @return  io.Stream
  */
 protected function archiveBytesAsStream($version = -1)
 {
     static $bytes = array(1 => "CCA", 2 => "CCA");
     $s = new Stream();
     $s->open(STREAM_WRITE);
     $s->write($bytes[$version < 0 ? $this->version() : $version]);
     $s->write(str_repeat("", 248));
     // Reserved bytes
     $s->close();
     return $s;
 }
开发者ID:Gamepay,项目名称:xp-framework,代码行数:16,代码来源:ArchiveTest.class.php

示例5: close

 /**
  * Closes this stream
  *
  * @return void
  */
 public function close()
 {
     $this->out->appendToken($this->out->format->close('}'));
     parent::close();
 }
开发者ID:xp-forge,项目名称:json,代码行数:10,代码来源:ObjectStream.class.php

示例6: save

 /**
  * Write the stream to the given destionation directly without using extra memory like storing in an array etc.
  *
  * @param mixed $destination file path.
  */
 public function save($destination)
 {
     $dest = new Stream(is_resource($destination) ? $destination : fopen($destination, 'w+'));
     while (!$this->feof()) {
         $dest->write($this->read());
     }
     if (!is_resource($destination)) {
         // close the file if we opened it otwhise dont touch.
         $dest->close();
     }
 }
开发者ID:RituKapoor,项目名称:php-apk-parser,代码行数:16,代码来源:Stream.php

示例7: close

 /**
  * 关闭某个客户端
  * @return unknown_type
  */
 function close($client_id)
 {
     Stream::close($this->client_sock[$client_id], $this->client_event[$client_id]);
     unset($this->client_sock[$client_id], $this->client_event[$client_id]);
     $this->protocol->onClose($this, $client_id, 0);
     $this->client_num--;
 }
开发者ID:jasonshaw,项目名称:framework-1,代码行数:11,代码来源:EventTCP.php

示例8: positionAfterReOpen

 public function positionAfterReOpen()
 {
     $s = new Stream();
     $s->open(STREAM_MODE_WRITE);
     $s->write('GIF89a');
     $s->close();
     $s->open(STREAM_MODE_READ);
     $this->assertEquals(0, $s->tell());
     $this->assertEquals('GIF89a', $s->read());
     $s->close();
 }
开发者ID:Gamepay,项目名称:xp-framework,代码行数:11,代码来源:StreamTest.class.php

示例9: testReadline

 public function testReadline()
 {
     $stream = new Stream();
     $stream->open(STREAM_MODE_WRITE);
     $stream->writeLine('This is the first line.');
     $stream->writeLine('This is the second line.');
     $stream->writeLine('And there is a third one.');
     $stream->close();
     $stream->open(STREAM_MODE_READ);
     $this->s = new EncapsedStream($stream, 5, $stream->size() - 35);
     $this->assertEquals('is the first line.', $this->s->readLine());
     $this->assertEquals('This is the second li', $this->s->readLine());
     $this->assertEquals('', $this->s->readLine());
 }
开发者ID:Gamepay,项目名称:xp-framework,代码行数:14,代码来源:EncapsedStreamTest.class.php


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