时间:2021-07-01 10:21:17 帮助过:16人阅读
delete_files.php $dir = "uploadfiles";//设置文件保存目录 注意包含/ $id=$_GET['delete']; $conn=mysql_connect('localhost','root',''); $flag=mysql_select_db('laborder' ,$conn); mysql_query("set names utf8"); $sql="select * from files where files_id='$id'"; $sqlupdate="delete from student where student_id='$id'"; $result=mysql_query($sql,$conn); if($lists=mysql_fetch_array($result)) { $name=$lists['files_name']; $a=dirname(__FILE__); $i=unlink($a/$dir/$name); if(mysql_query($sqlupdate)&&$i) { echo" "; echo ""; } }
$xxx = "{$a}/{$dir}/{$name}"; echo $xxx; unlink($xxx);
------解决方案--------------------
路径要对,权限要有,必须是个文件
------解决方案--------------------