<分区>
我有这个错误,多年来我一直在努力修复它。它似乎是凭空出现的,因为它所在的页面昨天运行良好。
错误是:
Warning: Cannot modify header information - headers already sent by (output started at /var/www/dev.racommerce.com/includes/header.php:97) in /var/www/dev.racommerce.com/cart.php on line 44
header.php文件中第97行的代码是:
<?for($i = 0; $i < $count; $i++)
{?>
<li><a class="dropDown" href="<?="http://" . $_SERVER['HTTP_HOST'];?>/products.php?cat=<?=$result[$i]['categoryID']?>"><?=$result[$i]['categoryName']?></a></li>
<?}?>
cart.php 文件第 44 行的代码是:
header("location: cart.php");
我一直在研究其他答案的解决方案,例如 How to fix "Headers already sent" error in PHP但我很难理解它们或在我的代码中实现它们。
有人可以帮我解决这个问题吗?