$cachedir="./data/html/".$model; //Cache文件的路径; if ($dh = opendir($cachedir)) { //打开Cache文件夹; while (($file = readdir($dh)) !== false) {//遍历Cache目录, $del = '/^index\_'.$material['url'].'\w+\.html/'; $a = preg_match($del,$file); if(preg_match($del,$file)){ $delfile = $cachedir.'/'.$file; $delres = unlink($delfile); //删除遍历到的每一个文件; } } closedir($dh); }
http://bbs.php100.com/read-htm-tid-83266.html