Current Location: Home> Function Categories> file_exists

file_exists

Check if the file or directory exists
Name:file_exists
Category:File system
Programming Language:php
One-line Description:Check if the file or directory exists.

Definition and usage

file_exists() function checks whether a file or directory exists.

Return true if the specified file or directory exists, otherwise return false.

Example

 <?php
echo file_exists ( "test.txt" ) ;
?>

Output:

 1

grammar

 file_exists ( path )
parameter Description
path Required. Specify the path to be checked.
Similar Functions
  • Create a file with a unique file name tempnam

    tempnam

    Createafilewithauniq
  • Read files (safely used in binary files) fread

    fread

    Readfiles(safelyused
  • Read a line from a file pointer fgets

    fgets

    Readalinefromafilepo
  • Establish symbolic connection symlink

    symlink

    Establishsymboliccon
  • Synchronize changes to files (including metadata) fsync

    fsync

    Synchronizechangesto
  • Rename a file or directory rename

    rename

    Renameafileordirecto
  • Return to the directory part in the path dirname

    dirname

    Returntothedirectory
  • Get file information through the opened file pointer fstat

    fstat

    Getfileinformationth
Popular Articles