简体   繁体   中英

session_start warning on line 1

I have a php file that starts out with:

<?php include "header.php"; ?>

The file header.php starts out with:

<?php session_start();
$login_output = "";

if ($_GET['process'] == 'logout') {
session_destroy();
} 

It's giving me this warning: Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/clicker/public_html/hstrial-RBochner/criteria.php:1) in /home/clicker/public_html/hstrial-RBochner/criteria.php on line 1

Am I crazy or is this saying it can't print line 1 because it's printing line 1? It works fine in all but one pesky file. I think I've checked everywhere for whitespace.

You cannot have any whitespaces before <?php session_start(); ?> <?php session_start(); ?> runs the <?php should be the first string in file criteria.php ;)

If your file is in Unicode format, then it has a pseudo-invisible Unicode "marker" as the first few characters.

As far as PHP is concerned, this is "output" before your header command, and there must be no output before header .

Try making your source file not Unicode.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM