- Unlink () function use instance
- // Use the unlink function to delete an object
- $ Filename = "data.txt"; // defines the variable
- Unlink ($ filename); // delete the file with unlinklinks. the filenameshould be the relative address, and the data.txt under the current webpage directory should be deleted. If the call succeeds, TRUE is returned. if the call fails, FALSE is returned.
- // When I first used the unlink function on the server today, an error is reported when I used the relative address. the file cannot be found, so I changed it to an absolute address and deleted it! The host is Windows and the server is lunix. The relative address is used in the window, and the absolute address is used in the lunix!
-
- The mkdir () function uses an instance.
- // Use the mkdir function to create a directory
- $ Dirname = "mydir"; // defines the variable
- Mkdir ($ dirname, 0700); // use mkdir to create a directory. the directory here is also relative. create a directory named "mydir" under the Directory of this webpage! If the call succeeds, TRUE is returned. if the call fails, FALSE is returned.
- // When I first used the unlink function on the server today, an error is reported when I used the relative address. the file cannot be found, so I changed it to an absolute address and deleted it! The host is Windows and the server is lunix. For now, the relative address is used in the window, and the absolute address is used in lunix!
- ?>
-
- The rmdir () function uses an instance.
- // Use the rmdir function to delete a directory
- $ Dirname = "mydir"; // defines the variable
- Rmdir ($ dirname); // use rmdir to delete the directory. the directory here is also relative to the directory on this page. delete the directory named "mydir! If the call succeeds, TRUE is returned. if the call fails, FALSE is returned.
- // When I first used the unlink function on the server today, an error is reported when I used the relative address. the file cannot be found, so I changed it to an absolute address and deleted it! The host is Windows and the server is lunix. For now, the relative address is used in the window, and the absolute address is used in lunix!
- ?>
In the system, images, documents, and so on are always required to be uploaded. in the background management, records are deleted without deleting the actually uploaded images. Now the server is very bloated, it is not difficult to delete the specified file, just like the unlink function! |