SplFileObject::getFlags

(PHP 5 >= 5.1.0)

SplFileObject::getFlagsGets flags for the SplFileObject

說明

public int SplFileObject::getFlags ( void )

Gets the flags set for an instance of SplFileObject as an integer.

參數

此函式沒有參數。

回傳值

Returns an integer representing the flags.

範例

Example #1 SplFileObject::getFlags() example

<?php
$file 
= new SplFileObject(__FILE__"r");

if (
$file->getFlags() & SplFileObject::SKIP_EMPTY) {
    echo 
"Skipping empty lines\n";
} else {
    echo 
"Not skipping empty lines\n";
}

$file->setFlags(SplFileObject::SKIP_EMPTY);

if (
$file->getFlags() & SplFileObject::SKIP_EMPTY) {
    echo 
"Skipping empty lines\n";
} else {
    echo 
"Not skipping empty lines\n";
}
?>

上例的輸出類似於:

Not skipping empty lines
Skipping empty lines

參見

add a note add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top