This typically occurs when there is unintended output from the script before you start the session. With your current code, you could try to use output buffering to solve it.
try adding a call to the ob_start();
function at the very top of your script and ob_end_flush();
at the very end of the document.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…