我有以下代码从数据库中删除记录。但是我也希望它从服务器中删除关联的文件。其中一列包含文件的路径。有人可以解释我将如何在这里使用 unlink 功能吗?
<?php
include('config.php');
if (isset($_GET['id']) && is_numeric($_GET['id']))
{
$id = $_GET['id'];
$result = mysql_query("DELETE FROM images WHERE id=$id")
or die(mysql_error());
header("Location: view.php");
}
else
{
header("Location: view.php");
}
?>