array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'zh', ), 'this' => array ( 0 => 'splfileobject.setflags.php', 1 => 'SplFileObject::setFlags', 2 => 'Sets flags for the SplFileObject', ), 'up' => array ( 0 => 'class.splfileobject.php', 1 => 'SplFileObject', ), 'prev' => array ( 0 => 'splfileobject.setcsvcontrol.php', 1 => 'SplFileObject::setCsvControl', ), 'next' => array ( 0 => 'splfileobject.setmaxlinelen.php', 1 => 'SplFileObject::setMaxLineLen', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/spl/splfileobject/setflags.xml', ), 'history' => array ( ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); contributors($setup); ?>

SplFileObject::setFlags

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

SplFileObject::setFlagsSets flags for the SplFileObject

说明

public SplFileObject::setFlags(int $flags): void

Sets the flags to be used by the SplFileObject.

参数

flags

Bit mask of the flags to set. See SplFileObject constants for the available flags.

返回值

没有返回值。

示例

示例 #1 SplFileObject::setFlags() example

<?php
$file
= new SplFileObject("data.csv");
$file->setFlags(SplFileObject::READ_CSV);
foreach (
$file as $fields) {
var_dump($fields);
}
?>

参见