(PHP 5 >= 5.1.0, PHP 7, PHP 8)
SplFileObject类为文件提供了一个面向对象接口.
$separator
= ",", string $enclosure
= "\"", string $escape
= "\\"): array|false$fields
,$separator
= ",",$enclosure
= "\"",$escape
= "\\",$eol
= "\n"$separator
= ",", string $enclosure
= "\"", string $escape
= "\\"): void$mode
= "r", bool $useIncludePath
= false
, ?resource $context
= null
): SplFileObjectSplFileObject::DROP_NEW_LINE
Drop newlines at the end of a line.
SplFileObject::READ_AHEAD
Read on rewind/next.
SplFileObject::SKIP_EMPTY
Skips empty lines in the file. This requires the READ_AHEAD
flag be enabled, to work as expected.
SplFileObject::READ_CSV
Read lines as CSV rows.
版本 | 说明 |
---|---|
5.3.9 |
SplFileObject::SKIP_EMPTY value changed to 4.
Previously, value was 6.
|