array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'zh', ), 'this' => array ( 0 => 'splfileobject.tostring.php', 1 => 'SplFileObject::__toString', 2 => 'Returns the current line as a string', ), 'up' => array ( 0 => 'class.splfileobject.php', 1 => 'SplFileObject', ), 'prev' => array ( 0 => 'splfileobject.setmaxlinelen.php', 1 => 'SplFileObject::setMaxLineLen', ), 'next' => array ( 0 => 'splfileobject.valid.php', 1 => 'SplFileObject::valid', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/spl/splfileobject/tostring.xml', ), 'history' => array ( ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); contributors($setup); ?>

SplFileObject::__toString

(PHP 5 >= 5.1.0, PHP 7, PHP 8)

SplFileObject::__toStringReturns the current line as a string

说明

public SplFileObject::__toString(): string

This method will return the current line as a string.

参数

此函数没有参数。

返回值

Returns the current line as a string.

更新日志

版本 说明
8.1.14, 8.2.1 Changed from an alias of SplFileObject::fgets() to an implementation of SplFileObject::current() which returns a CSV string when the SplFileObject::READ_CSV flag is set.
7.2.19, 7.3.6 Changed from an alias of SplFileObject::current() to an alias of SplFileObject::fgets().