本文整理匯總了PHP中Stream::writeLine方法的典型用法代碼示例。如果您正苦於以下問題:PHP Stream::writeLine方法的具體用法?PHP Stream::writeLine怎麽用?PHP Stream::writeLine使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Stream
的用法示例。
在下文中一共展示了Stream::writeLine方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testSeekTell
public function testSeekTell()
{
$s = new Stream();
$s->open(STREAM_MODE_READWRITE);
$this->assertEquals($s->tell(), 0, 'wrong start position');
$this->assertEquals($s->size(), 0, 'wrong initial size');
$s->writeLine('Foo Bar Baz');
$this->assertEquals($s->tell(), 12, 'wrong position');
$this->assertEquals($s->size(), 12, 'wrong size');
}
示例2: 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());
}