©
이 문서에서는 PHP 중국어 웹사이트 매뉴얼 풀어 주다
(PHP 5 >= 5.1.0)
SplFileObject::setMaxLineLen — Set maximum line length
$max_len
)Sets the maximum length of a line to be read.
max_len
The maximum length of a line.
没有返回值。
Throws DomainException when
max_len
is less than zero.
Example #1 SplFileObject::setMaxLineLen() example
<?php
$file = new SplFileObject ( "lipsum.txt" );
$file -> setMaxLineLen ( 20 );
foreach ( $file as $line ) {
echo $line . "\n" ;
}
?>
Contents of lipsum.txt
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis nec sapien felis, ac sodales nisl. Nulla vitae magna vitae purus aliquet consequat.
以上例程的输出类似于:
Lorem ipsum dolor s it amet, consectetu r adipiscing elit.Duis nec sapien fel is, ac sodales nisl .Nulla vitae magna v itae purus aliquet consequat.