Home >Backend Development >PHP Tutorial >Example of deleting a group of files in php

Example of deleting a group of files in php

WBOY
WBOYOriginal
2016-07-25 08:56:05899browse
  1. file1.html
  2. file2.html
  3. file3.html
复制代码

2,删除一组文件的代码 process.php

  1. # Take each checked value, and give it a name of $delete
  2. foreach($_POST['delete'] as $delete){
  3. # Make sure the file actually exists
  4. if(file_exists("/location/of/directory/".$delete)){
  5. # Delete each file
  6. unlink("/location/of/directory/",$delete);
  7. }else{
  8. continue;
  9. }
  10. }
  11. # Return to form.html
  12. header("Location: form.html");
  13. ?>
复制代码

您可能感兴趣的文章:

Php删除指定文件与文件夹的方法 PHP删除N分钟前创建的所有文件的小例子 php实例:批量删除文件夹及文件夹中的文件 删除指定文件夹中所有文件的php代码 删除多级目录的php自定义函数 php递归删除文件与目录的代码 php递归删除目录及多级子目录下所有文件的代码 php递归创建和删除文件夹的代码 php递归删除目录的例子


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn