我正在调用位于我的“上传”目录中的 .php 文件以从文件系统中删除。需要搜索的目录将始终位于“uploads/$_SESSION['email']”中。这是我目前拥有的:
<?php
session_start();
require('../mysqli_connect.php');
$old = getcwd(); // Save the current directory
$new = './'.$_SESSION['email'];
chdir($new);
$delpaths = "SELECT `title` FROM `upload` WHERE `upload_id` IN ({$id_array}) AND `owner_id` =". $_SESSION['user_id'];
$getpaths = mysqli_query($dbc, $delpaths);
while ($row = mysqli_fetch_array($getpaths, MYSQLI_ASSOC))
{
chown($row, 666);
function removeupload() {
$todelete = $row;
unlink($todelete);
chdir($old);
}
}
?>