Various URL-style protocols can be used with filesystem functions with the help of corresponding built-in wrappers avalable in PHP. The stream_wrapper_register() function is also there to define custom wrapper.
Default wrapper in PHP is file:// and it represents local filesystem. If no other protocol is explicitly used, PHP parser treats it as filesystem wrapper. The filename argument to be given to filesystem functions fopen(), file_get_contents() etc uses file:// protocol by default.
When file name doesn't begin with forward or backward slash, or drive letter in Windows, its path is taken as relative to current directory. However, in fopen() and file_get_contents() functions, file name may be searched in locations mentioned in include_path directive.
The file:// wrapper supports simultaneous read/write operations, creating and removing directory, and renaming a file. Also, file access is not restricted by allow_url_fopen directive in php.ini configuration settings.
Representation of file name in different possible ways is as follows −
//relative path (assuming current working directory is c:\xampp\php, file is opened in tst subdirectory)
//current path. File will be opened in c:\xampp\php\test directory assuming it as current directory
//using file://protocolfor absolute path
//using file://protocol for file in document root