Notice: A session had already been started – ignoring session_start()...

出现以下错误的解决办法:

Notice: A session had already been started – ignoring session_start() in .. on line ..

之所以出现这种情况是页面中多次使用了 session_start()函数

有以下两种解决办法:

1) in php.ini file set session.autostart to 0 配置php.ini 设置session.autostart =0

session.auto_start = 0

2) In your code use this line 在出现错误的页面中编辑你的代码如下:

if (!session_id()) session_start();

instead of

session_start();