Home >php教程 >php手册 >PHP程序中使用session错误调试问题

PHP程序中使用session错误调试问题

WBOY
WBOYOriginal
2016-06-13 10:29:35981browse

开发需要接触PHP,感觉上手也挺快,在调试PHP中的SESSION时总是出错,

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at XXX:2) in .php on line 3

类似错,对照源码好像自己没有哪里写错.

php开始符号

session在开始前不能有任何字符输出,

header()是一样的

将代码提前,去除前面的空格,就可以了.

-------------------正确

session_start();
$username;
$username = "test";
session_register("username");
echo $_SESSION[username];
?>

-------------------错误


session_start();
$username;
$username = "test";
session_register("username");
echo $_SESSION[username];
?>


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn