关于删除文件的绝对路径问题 求指点
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" <script type='text/javascript'>" ."txtOption='删除成功!';". "alert(txtOption);"; echo "</script>"; echo "<script>window.location.href='admin_files.php';</script>"; } }
$xxx = "{$a}/{$dir}/{$name}";echo $xxx;unlink($xxx);
[解决办法]
路径要对,权限要有,必须是个文件
[解决办法]