header('Location: '.$page)函数不工作


header('Location: '.$page) function not working

有人能帮帮我吗?我使用php执行购物车,在几次定制之后,我的header()函数停止工作。我就是不明白为什么。谢谢你的帮助。

$page = 'index.php';
if (isset($_GET['add'])) {
    $con = mysqli_connect("localhost", "noivaem", "password", "noivaem") or die (mysqli_error());
    $quantity = mysqli_query($con, "SELECT id, quantity FROM Products WHERE id=".mysqli_real_escape_string($con, $_GET['add']));
    while($quantity_row = mysqli_fetch_assoc ($quantity)) {
        $_SESSION['cart_'.(int)$_GET['add']]+=1;}
    header('Location: '.$page); }

检查在header()

之前没有任何内容输出到浏览器

提示:您的代码中有错误

经过几个小时的代码研究,我终于找到了导致Header不起作用的原因。有一个特定的jquery脚本可以避免标题正常工作。我删除了jquery脚本行,知道它工作得很好。我的页面被破坏了,但我只需要手动重新配置。不管怎样,谢谢你的帮助。问候,Roberto