当我测试我的脚本时,我得到了这个错误
Warning: Cannot modify header information - headers already sent by (output started at /nfs/c06/h04/mnt/153892/domains/authomotive.com/html/artpoint/gallery/index.php:12) in /nfs/c06/h04/mnt/153892/domains/authomotive.com/html/artpoint/gallery/main.php on line 17
我们当然都知道我删除了其他文件中的所有空格并将 ob_start() 和 ob_flush() 添加到文件中我还能做什么?我是否必须找到另一种发送标头的方法,或者是否有另一种方法可以绕过此警告?
该脚本从我的数据库和地图中删除了一个文件。
main.php 的来源
<?php
ob_start();
if(isset($_GET['remove'])){
$id=$_GET['id'];
include('conf.php');
require_once('classes/db.class.php');
$db = new DB($db_name,$db_host,$db_user,$db_passw);
$q = $db->query('SELECT photourl,minurl,projectID FROM photo WHERE id='.$id);
while ($line = $db->fetchNextObject()) {
$file = $line->photourl;
unlink($file);
$filemin = $line->minurl;
unlink($filemin);
}
//$db->execute('DELETE FROM project WHERE id='.$line->projectID,true);
$db->execute('DELETE FROM photo WHERE id='.$id);
header("Location:index.php");
}
if(isset($_GET['success'])){
echo('het werkt');
}
ob_flush();
?>
<h1> Projecten </h1>
<ul id="edit-menu">
<li>
<ul>
<li><a class="addPro" href="#"><img src="images/addProject.png" /></a></li><br/>
<li><a class="add" style="padding-left:15px"href="#">Project +</a></li>
</ul>
</li>
<li>
<ul>
<li><a class="addPho" href="#"><img src="images/add.png" /></a></li><br/>
<li><a class="add" href="#">Toevoegen </a></li>
</ul>
</li>
<li>
<ul>
<li><a class="deletePho" href="#"><img src="images/delete.png" /></a></li><br/>
<li><a href="#">Verwijderen </a></li>
</ul>
</li>
<div id="addproject">
<?php include('addproject.php'); ?>
</div>
<div id="addphoto">
<?php include('addphoto.php'); ?>
</div>
<div id="deletephoto">
<?php include('removePhoto.php'); ?>
</div>
</ul>