Below I have added three php files to my favorites. He can use unlink to delete any files that can be deleted. This program wants to delete files, images, and compressed files. We have used several methods for example.
Below I have added three to my favoritesDelete files in the php tutorialOh, he can useUnlink delete any deletableThis program is used to delete files, images, and compressed files.
Three php File Deletion Codes
If ($ od = opendir ($ d) // $ d is the directory name.
{
While ($ file = readdir ($ od ))! = False) // www.zhutiai.com
{
Unlink ($ file); // $ file is the file name.
}
}
To solve these three php functions: opendir () readdir () unlink ()
File Deletion Code 2 system call Method
Function del_dir ($ dir)
{
If (strtoupper (substr (php_ OS, 0, 3) = 'win '){
$ Str = "rmdir/s/q". $ dir;
} Else {
$ Str = "rm-rf". $ dir;
}
}
File Deletion code 3
$ Info = "a123"; // directory name
If (is_dir ($ info )){
If (rmdir ($ info )){
Echo "The {$ inof} directory has been deleted. www.bkjia.com ";
} Else {
Echo "directory cannot be deleted! Cause: A file still exists in the directory! ";
}
}
If (is_file ($ info )){
If (unlink ($ info )){
Echo "file {$ info} deleted ...! ";
} Else {
An error occurred while deleting the echo file {$ info} mb.php100.com ...! Try to modify the File Permission to delete ...";
If (chmod ($ info, 0777 )){
Unlink ($ info );
Echo "file {$ info} permission modified and deleted ...";
} Else {
Echo "the file {$ info} cannot be deleted on the web. The ftp permission may be set for this file ...";
}
}
}
Recently, many websites have been reposted on this site. Please add this site connection. Thank you for your cooperation!