Rumah >pembangunan bahagian belakang >tutorial php > 关于删除文件的绝对路径有关问题 求指点
关于删除文件的绝对路径问题 求指点
<!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --> 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); <br><font color="#e78608">------解决方案--------------------</font><br>路径要对,权限要有,必须是个文件 <br><font color="#e78608">------解决方案--------------------</font><br>