开发需要接触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];
?>