File

php\io\File

Class File

Constants


constant PATH_SEPARATOR
constant DIRECTORY_SEPARATOR
constant PATH_NAME_CASE_INSENSITIVE

Methods


__construct($path, $child = NULL)
Parameters:
  • $pathstring
  • $childnull, string
exists()
Returns:bool
canExecute()
Returns:bool
canWrite()
Returns:bool
canRead()
Returns:bool
getName()
Returns:string
getAbsolutePath()
Returns:string
getCanonicalPath()

throws php\io\IOException

Returns:string
getParent()
Returns:string
getPath()
Returns:string
getAbsoluteFile()
Returns:php\io\File
getCanonicalFile()

throws php\io\IOException

Returns:php\io\File
getParentFile()
Returns:php\io\File
mkdir()
Returns:bool
mkdirs()
Returns:bool
isFile()
Returns:bool
isDirectory()
Returns:bool
isAbsolute()
Returns:bool
isHidden()
Returns:bool
matches($pattern)
Parameters:
  • $patternstring - the “glob” and “regex” syntaxes, and may support others.
Returns:

bool

delete()
Returns:bool
deleteOnExit()
Returns:void
createNewFile($withDirs = false)
Parameters:
  • $withDirsbool
Returns:

bool

lastModified()
Returns:int
length()
Returns:int
crc32()
Returns:int, null null if not exists or io exception
hash($algorithm = 'MD5')
Parameters:
  • $algorithmstring
Returns:

string, null if not exists or io exception

renameTo($newName)
Parameters:
  • $newNamestring
Returns:

bool

setExecutable($value, $ownerOnly = true)
Parameters:
  • $valuebool
  • $ownerOnlybool
Returns:

bool

setWritable($value, $ownerOnly = true)
Parameters:
  • $valuebool
  • $ownerOnlybool
Returns:

bool

setReadable($value, $ownerOnly = true)
Parameters:
  • $valuebool
  • $ownerOnlybool
Returns:

bool

setReadOnly()
Returns:bool
setLastModified($time)
Parameters:
  • $timeint
Returns:

bool

compareTo($file)
Parameters:
Returns:

int

find($filter = null)

throws php\io\IOException

Parameters:
  • $filtercallable
Returns:

string[]

findFiles($filter = null)

throws php\io\IOException

Parameters:
  • $filtercallable - (File $directory, $name)
Returns:

php\io\File[]

static createTemp($prefix, $suffix, $directory = null)
Parameters:
  • $prefixstring
  • $suffixstring
  • $directorynull, php\io\File, string
Returns:

php\io\File

static listRoots

List the available filesystem roots. Returns an array of objects denoting the available filesystem roots, or empty array if the set of roots could not be determined. The array will be empty if there are no filesystem roots.

Returns:php\io\File[]
static of($path)
Parameters:
  • $pathstring
Returns:

php\io\File