关于删除文件的绝对路径问题 求指点
<!--
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>
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号