• 首页
  • css3教程
  • html5教程
  • jQuery手册
  • php7教程
  • MySQL手册
  • apache手册
  • 位置: php7教程 -> PHP7标准库 (SPL)

    文件处理

    The SplFileInfo class

    (PHP 5 >= 5.1.2, PHP 7)

    简介

    The SplFileInfo class offers a high-level object oriented interface to information for an individual file.

    类摘要

    SplFileInfo 
    {
    /* 方法 */
    public __construct ( string $file_name )
    public getATime ( void ) : int
    public getBasename ([ string $suffix ] ) : string
    public getCTime ( void ) : int
    public getExtension ( void ) : string
    public getFileInfo ([ string $class_name ] ) : SplFileInfo
    public getFilename ( void ) : string
    public getGroup ( void ) : int
    public getInode ( void ) : int
    public getLinkTarget ( void ) : string
    public getMTime ( void ) : int
    public getOwner ( void ) : int
    public getPath ( void ) : string
    public getPathInfo ([ string $class_name ] ) : SplFileInfo
    public getPathname ( void ) : string
    public getPerms ( void ) : int
    public getRealPath ( void ) : string
    public getSize ( void ) : int
    public getType ( void ) : string
    public isDir ( void ) : bool
    public isExecutable ( void ) : bool
    public isFile ( void ) : bool
    public isLink ( void ) : bool
    public isReadable ( void ) : bool
    public isWritable ( void ) : bool
    public openFile ([ string $open_mode = "r" [, bool $use_include_path = FALSE [, resource $context = NULL ]]] ) : SplFileObject
    public setFileClass ([ string $class_name = "SplFileObject" ] ) : void
    public setInfoClass ([ string $class_name = "SplFileInfo" ] ) : void
    public __toString ( void ) : string
    }
    

    The SplFileObject class

    (PHP 5 >= 5.1.0, PHP 7)

    简介

    SplFileObject类为文件提供了一个面向对象接口.

    类摘要

    SplFileObject extends SplFileInfo implements RecursiveIterator , SeekableIterator
    {
    /* 常量 */
    const integer DROP_NEW_LINE = 1 ;
    const integer READ_AHEAD = 2 ;
    const integer SKIP_EMPTY = 4 ;
    const integer READ_CSV = 8 ;
    /* 方法 */
    public current ( void ) : string|array
    public eof ( void ) : bool
    public fflush ( void ) : bool
    public fgetc ( void ) : string
    public fgetcsv ([ string $delimiter = "," [, string $enclosure = "\"" [, string $escape = "\\" ]]] ) : array
    public fgets ( void ) : string
    public fgetss ([ string $allowable_tags ] ) : string
    public flock ( int $operation [, int &$wouldblock ] ) : bool
    public fpassthru ( void ) : int
    public fputcsv ( array $fields [, string $delimiter = "," [, string $enclosure = '"' [, string $escape = "\\" ]]] ) : int
    public fread ( int $length ) : string
    public fscanf ( string $format [, mixed &$... ] ) : mixed
    public fseek ( int $offset [, int $whence = SEEK_SET ] ) : int
    public fstat ( void ) : array
    public ftell ( void ) : int
    public ftruncate ( int $size ) : bool
    public fwrite ( string $str [, int $length ] ) : int
    public getChildren ( void ) : void
    public getCsvControl ( void ) : array
    public getFlags ( void ) : int
    public getMaxLineLen ( void ) : int
    public hasChildren ( void ) : bool
    public key ( void ) : int
    public next ( void ) : void
    public rewind ( void ) : void
    public seek ( int $line_pos ) : void
    public setCsvControl ([ string $delimiter = "," [, string $enclosure = "\"" [, string $escape = "\\" ]]] ) : void
    public setFlags ( int $flags ) : void
    public setMaxLineLen ( int $max_len ) : void
    public valid ( void ) : bool
    /* 继承的方法 */
    public SplFileInfo::getATime ( void ) : int
    public SplFileInfo::getBasename ([ string $suffix ] ) : string
    public SplFileInfo::getCTime ( void ) : int
    public SplFileInfo::getExtension ( void ) : string
    public SplFileInfo::getFileInfo ([ string $class_name ] ) : SplFileInfo
    public SplFileInfo::getFilename ( void ) : string
    public SplFileInfo::getGroup ( void ) : int
    public SplFileInfo::getInode ( void ) : int
    public SplFileInfo::getLinkTarget ( void ) : string
    public SplFileInfo::getMTime ( void ) : int
    public SplFileInfo::getOwner ( void ) : int
    public SplFileInfo::getPath ( void ) : string
    public SplFileInfo::getPathInfo ([ string $class_name ] ) : SplFileInfo
    public SplFileInfo::getPathname ( void ) : string
    public SplFileInfo::getPerms ( void ) : int
    public SplFileInfo::getRealPath ( void ) : string
    public SplFileInfo::getSize ( void ) : int
    public SplFileInfo::getType ( void ) : string
    public SplFileInfo::isDir ( void ) : bool
    public SplFileInfo::isExecutable ( void ) : bool
    public SplFileInfo::isFile ( void ) : bool
    public SplFileInfo::isLink ( void ) : bool
    public SplFileInfo::isReadable ( void ) : bool
    public SplFileInfo::isWritable ( void ) : bool
    public SplFileInfo::openFile ([ string $open_mode = "r" [, bool $use_include_path = FALSE [, resource $context = NULL ]]] ) : SplFileObject
    public SplFileInfo::setFileClass ([ string $class_name = "SplFileObject" ] ) : void
    public SplFileInfo::setInfoClass ([ string $class_name = "SplFileInfo" ] ) : void
    public SplFileInfo::__toString ( void ) : string
    }
    

    The SplTempFileObject class

    (PHP 5 >= 5.1.2, PHP 7)

    简介

    The SplTempFileObject class offers an object oriented interface for a temporary file.

    类摘要

    SplTempFileObject extends SplFileObject implements SeekableIterator , RecursiveIterator
    {
    /* 继承的常量 */
    const integer SplFileObject::DROP_NEW_LINE = 1 ;
    const integer SplFileObject::READ_AHEAD = 2 ;
    const integer SplFileObject::SKIP_EMPTY = 4 ;
    const integer SplFileObject::READ_CSV = 8 ;
    /* 方法 */
    public __construct ([ int $max_memory ] )
    /* 继承的方法 */
    public SplFileObject::current ( void ) : string|array
    public SplFileObject::eof ( void ) : bool
    public SplFileObject::fflush ( void ) : bool
    public SplFileObject::fgetc ( void ) : string
    public SplFileObject::fgetcsv ([ string $delimiter = "," [, string $enclosure = "\"" [, string $escape = "\\" ]]] ) : array
    public SplFileObject::fgets ( void ) : string
    public SplFileObject::fgetss ([ string $allowable_tags ] ) : string
    public SplFileObject::flock ( int $operation [, int &$wouldblock ] ) : bool
    public SplFileObject::fpassthru ( void ) : int
    public SplFileObject::fputcsv ( array $fields [, string $delimiter = "," [, string $enclosure = '"' [, string $escape = "\\" ]]] ) : int
    public SplFileObject::fread ( int $length ) : string
    public SplFileObject::fscanf ( string $format [, mixed &$... ] ) : mixed
    public SplFileObject::fseek ( int $offset [, int $whence = SEEK_SET ] ) : int
    public SplFileObject::fstat ( void ) : array
    public SplFileObject::ftell ( void ) : int
    public SplFileObject::ftruncate ( int $size ) : bool
    public SplFileObject::fwrite ( string $str [, int $length ] ) : int
    public SplFileObject::getChildren ( void ) : void
    public SplFileObject::getCsvControl ( void ) : array
    public SplFileObject::getFlags ( void ) : int
    public SplFileObject::getMaxLineLen ( void ) : int
    public SplFileObject::hasChildren ( void ) : bool
    public SplFileObject::key ( void ) : int
    public SplFileObject::next ( void ) : void
    public SplFileObject::rewind ( void ) : void
    public SplFileObject::seek ( int $line_pos ) : void
    public SplFileObject::setCsvControl ([ string $delimiter = "," [, string $enclosure = "\"" [, string $escape = "\\" ]]] ) : void
    public SplFileObject::setFlags ( int $flags ) : void
    public SplFileObject::setMaxLineLen ( int $max_len ) : void
    public SplFileObject::valid ( void ) : bool
    }