略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: SplFileObject::getFlags

2024-04-28

SplFileObject::getFlags

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

SplFileObject::getFlagsGets flags for the SplFileObject

说明

public SplFileObject::getFlags(): int

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

参数

此函数没有参数。

返回值

Returns an int representing the flags.

范例

示例 #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 noteadd a note

User Contributed Notes

There are no user contributed notes for this page.

官方地址:https://www.php.net/manual/en/splfileobject.getflags.php

北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3