©
This document uses PHP Chinese website manual Release
(PHP 5 >= 5.1.0)
SplFileObject::getFlags — Gets flags for the SplFileObject
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