Home  >  Article  >  Backend Development  >  Using session errors to debug problems in PHP programs_PHP tutorial

Using session errors to debug problems in PHP programs_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 17:30:08907browse

Development requires contact with PHP, and I feel that I can get started quickly. I always make errors when debugging SESSION in PHP,

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

Similar to the error, I looked at the source code and it seems that I didn’t make any mistakes.

php start symbol

The session cannot output any characters before starting,

header() is the same

Add the code in advance and remove the spaces in front of it, and that’s it.

------------------Correct

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

------------------Error


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


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/509216.htmlTechArticleDevelopment requires contact with PHP, and I feel that I can get started quickly. I always make errors when debugging SESSION in PHP. Warning: session_start(): Cannot send session cache limiter - headers already sent (output sta...
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