1. Create a directory (folder)
MkDir ("./test");
2. Deleting a directory (folder) can only delete empty folders
RmDir ("./test");
3. Move directory (folder)
Rename ("./test", ".. /test11 ");
File operations
Touch ("./test.txt"); Create a file
Copy ("./test.txt", ".. /test.txt "); Copying files
Unlink ("./test.docx"); deleting files
File_get_contents ("./test.txt"); Get file contents: TXT page
File_get_contents ("http://www.baidu.com"); Get content remotely
File_put_contents ("./test.txt", "Hello"); Writing content to a file
ReadFile ("./test.txt"); Get file contents and output directly
File ("./test.txt") reads the contents of the files, returns the array, and each element of the array corresponds to a row
Manipulating the contents of a file
1. Open a file resource
$fp = fopen ("./test.txt", "a");
Manipulating files
echo fgetc ($FP); Read one character at a time
while (!feof ($FP)) determines whether the file is read to the end
{
echo fgetc ($FP);
}
Echo fgets ($FP); Read one line at a time
Echo fgets ($FP);
Echo fread ($FP, 10); Read a specific length
$str = "Ni hao dhakhdak \ r \ n Akdhka";
$str = Iconv ("Utf-8", "gb2312", $str);
Fwrite ($fp, $STR);
2. Close File Resources
Fclose ($FP);
Directory Operations (PHP)