A session had already been started – ignoring session_start() 怎么办?

Posted God is Love

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了A session had already been started – ignoring session_start() 怎么办?相关的知识,希望对你有一定的参考价值。

php警告提示A session had already been started – ignoring session_start() 解决方案

访问log日志发现有个这样的警告

主要是在TP框架中有代码已经开启了session,但是有些地方又防止忘了加,而重复添加。

 

问题代码:

session_start();

是为了避免更多问题以及性能和安全!

判断 如果session_id 不存在,说明没有储存, 开启session

if (!session_id()) session_start();

就这样就可以了;

文章来源:刘俊涛的博客

地址:http://www.cnblogs.com/lovebing

欢迎关注,有问题一起学习欢迎留言、评论。

以上是关于A session had already been started – ignoring session_start() 怎么办?的主要内容,如果未能解决你的问题,请参考以下文章

mac smartsvn is already a working copy for different url 怎么处理

a different object with the same identifier value was already associated with the session

解决a different object with the same identifier value was already associated with the session错误

解决a different object with the same identifier value was already associated with the session错误

PHP错误Warning: Cannot modify header information - headers already sent by解决方法

a different object with the same identifier value was already associat