Cách 1: <?php $data="your_file_name.txt"; $dir = "upload"; $dirHandle = opendir($dir); while ($file = readdir($dirHandle)) { if($file==$data) { unlink($dir."/".$file);//give correct path, } } closedir($dirHandle); ?> cách 2 : <?php $file='tên_file'; unlink("upload/".$file); ?>
Leave a Comment