>  기사  >  백엔드 개발  >  php删除一组文件的例子

php删除一组文件的例子

WBOY
WBOY원래의
2016-07-25 08:56:05843검색
  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递归删除目录的例子


성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.