Troubleshooting “Warning: session_start(): Cannot send session cache limiter - headers already sent”

后端 未结 15 1775
醉酒成梦
醉酒成梦 2020-11-28 14:34

i am getting Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at error

<
15条回答
  •  旧时难觅i
    2020-11-28 15:16

    You will find I have added the session_start() at the very top of the page. I have also removed the session_start() call later in the page. This page should work fine.

    
    
    
    
    
    
    Welcome
    
    
    
        
    
    
    
    
    
     
     
    -> Products
    -> Categories
    -> Sub Categories
     
     

    Manage Categories

     

    " . $_SESSION['error'] . "

    "; unset($_SESSION['error']); } ?>

           

             


    "; print_r($array); echo ""; } $TARGET_PATH = "images/category"; $cname = $_POST['categoryname']; $image = $_FILES['image']; $cname = mysql_real_escape_string($cname); $image['name'] = mysql_real_escape_string($image['name']); $TARGET_PATH .= $image['name']; if ( $cname == "" || $image['name'] == "" ) { $_SESSION['error'] = "All fields are required"; header("Location: managecategories.php"); exit; } if (!is_valid_type($image)) { $_SESSION['error'] = "You must upload a jpeg, gif, or bmp"; header("Location: managecategories.php"); exit; } if (file_exists($TARGET_PATH)) { $_SESSION['error'] = "A file with that name already exists"; header("Location: managecategories.php"); exit; } if (move_uploaded_file($image['tmp_name'], $TARGET_PATH)) { $sql = "insert into Categories (CategoryName, FileName) values ('$cname', '" . $image['name'] . "')"; $result = mysql_query($sql) or die ("Could not insert data into DB: " . mysql_error()); header("Location: mangaecategories.php"); exit; } else { $_SESSION['error'] = "Could not upload file. Check read/write persmissions on the directory"; header("Location: mangagecategories.php"); exit; } ?>

    提交回复
    热议问题