我的php中session_start();为什么不可以用呢?

来源:百度知道 编辑:UC知道 时间:2024/04/30 08:08:49
我的php中session_start();为什么不可以用呢?一用就要出现一个错误,不知道怎么回事,还有setcookie();也不可以用,实在很令人郁闷,查了很多资料。错误的现象就是这样的:
Warning: session_start(): Cannot send session cookie - headers already sent by (output started at d:\easyphp\www\inc\new.php:8) in d:\easyphp\www\inc\new.php on line 54

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at d:\easyphp\www\inc\new.php:8) in d:\easyphp\www\inc\new.php on line 54
是不是要在php.ini之中设置什么啊?

session_start()之前有输出了,检查一下session_start()之前是否有语句。一定要写在首行。

1.检查 session_start(); 或者 setcookie 函数在同一页面是否重复使用
2.修改 php.ini 里的 session.auto_start = 0 为 session.auto_start = 1
3.重新安装php