stream_get_line Gets line from stream resource up to a given delimiter


stream_get_line

(PHP 5)

stream_get_lineGets line from stream resource up to a given delimiter

说明

string stream_get_line ( resource $handle , int $length [, string $ending ] )

Gets a line from the given handle.

Reading ends when length bytes have been read, when the string specified by ending is found (which is not included in the return value), or on EOF (whichever comes first).

This function is nearly identical to fgets() except in that it allows end of line delimiters other than the standard , , and , and does not return the delimiter itself.

参数

handle

A valid file handle.

length

The number of bytes to read from the handle.

ending

An optional string delimiter.

返回值

Returns a string of up to length bytes read from the file pointed to by handle.

If an error occurs, returns FALSE.

参见

  • fread() - 读取文件(可安全用于二进制文件)
  • fgets() - 从文件指针中读取一行
  • fgetc() - 从文件指针中读取字符

«  stream_get_filters
» stream_get_meta_data
快速导航

Copyright © 2016 phpStudy | 豫ICP备2021030365号-3