Delete images from a folder

后端 未结 4 631
没有蜡笔的小新
没有蜡笔的小新 2020-12-16 20:59

I want to to destroy all images within a folder with PHP how can I do this?

4条回答
  •  有刺的猬
    2020-12-16 21:25

    The easiest (non-recursive) way is using glob():

    $files = glob('folder/*.jpg');
    foreach($files as $file) {
        unlink($file);
    }
    

提交回复
热议问题