Why can't I use session_start() in my php script? It says headers are already sent

后端 未结 2 1933
长情又很酷
长情又很酷 2020-12-11 20:25

Here are the first few lines of my page:


<         


        
2条回答
  •  猫巷女王i
    2020-12-11 21:15

    You either misread or the other forums are wrong. Just because session_start() is in the first "block" of PHP code doesn't mean it will work.

    session_start() needs to be run before the headers are sent.

    The solution in your case is:

    Move session_start(); above ...

提交回复
热议问题