1、fopen() fwrite() fclose() fiel_put_contents
1) fopen (path,′xx′) Open a file xx=r read-only open and point the pointer to the head xx=r+ read-write mode to open xx=w write, and empty the contents of the file, the pointer executes the head, does not exist then create xx=w+ read and write mode, followed by xx= A writes a method and executes the pointer to the head, but the write overwrites the previous content, and if it does not, creates a xx=a+ read-write mode, other than 2) fwrite (
Handle,content) Writing text to a file
3) Flcose ($path) Close file
4) file_put_contents (' file ', content) writes to the file
Application scenario: Do file cache and do website log record, etc.
2、fread() feof() fgets() fgetss() fgetc() file_get_contents() file()
1) fread (handle,
Size) Gets the contents of a specified byte in uppercase from a file
2) feof ($handle) to determine if the pointer has reached the tail
3) fgets () reads a line from the file
4) FGETSS () read a line and come over the HTML
4) fgetc () reads a character from the file
5) file_get_contents () get content from a file handle
6) file () ibid.
Scenario: Concurrency is not very high when you can configure a file lock mechanism to do the queue function
for example:handle=fopen(′1.txt′,′r′);while(!feof(handle)){echo fgetc($handle);}fclose($handle);
3, File_exists ()
1) file_exists () check whether the file or directory exists
Application scenario, when we do the image upload, determine whether the directory exists, if not exist to create
for example:handle=′uploads/test′;if(!fileexists(handle)){mkdir($handle,0777,true);}
4, Is_dir () Is_file () Is_link () is_readable () is_writeable () is_writable () Is_uploaded_file () is_executable ()
1) whether Is_dir () is a directory
2) Is_file () is a file
Application scenario: When we loop through a directory, we can determine whether it is a directory, if it is recursive traversal
5、copy() move_uploaded_file() rename()1)copy(one,two)2)move_uploaded_file()
Application scenario: Uploading images, moving temporary files to a specified directory
3)rename()6、filesize() filetype()
1) filesize () Gets the size of the file
2) filetype () Gets the type of file
7, PathInfo ()
1) PathInfo () returns information for the path
8, DirName () basename ()
1) dirname () returns the directory part of the path
2) basename () returns the file part of the path
9, Fileatime () filemtime () filectime () Touch ()
1) fileatime () Gets the last access time of the file
2) Filemtime () Gets the modified time of the file
3) Filectime () Gets the modified time of the file
4) Touch () set the file access and modification times
10, mkdir () unlink () rmdir ()
1) mkdir (path,0777,true) Create file 2) unlink (
file) Delete files
3) rmdir () Delete directory
11, feof () fseek () Rewind () Ftell ()
1) feof () test whether the file is at the end of the file file location
2) Fsweek () position the pointer in the file
3) Rewind () rewind the position of the file pointer
4) Ftell () returns the location of the file read and write
You should be in this position. Learn PHP (4)