Heim  >  Artikel  >  Backend-Entwicklung  >  PHP程序中使用session错误调试问题_PHP教程

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

WBOY
WBOYOriginal
2016-07-13 17:30:08908Durchsuche

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


www.bkjia.comtruehttp://www.bkjia.com/PHPjc/509216.htmlTechArticle开发需要接触PHP,感觉上手也挺快,在调试PHP中的SESSION时总是出错, Warning: session_start(): Cannot send session cache limiter - headers already sent (output sta...
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn