我的代码 -
if ($result)
{
$row = $result->fetch_object();
$filename = $row->src;
$q = "delete from photos WHERE id=$fileid";
$result = $mysqli->query($q) or die(mysqli_error($mysqli));
if ($result)
{
$filepath = "./images/";
if(fileDelete($filepath,$filename))
{
echo "success";
header("Location: index.php");
exit;
}
else echo "failed";
}
}
输出 -
success Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\pics\deletepic.php:31) in C:\xampp\htdocs\pics\deletepic.php on line 32
答案 0 :(得分:5)
在发送标题之前无法回复任何内容。
答案 1 :(得分:0)
删除echo "success";
答案 2 :(得分:0)
您无法向客户端发送任何内容,然后发送标头,或设置Cookie等类似内容。它不起作用,因为在HTTP中首先发送标题,当你开始响应主体时,你不能返回并重写标题。