在PHP中,多次运行session_start()有什么害处吗? [英] In PHP, is there any harm in running session_start() multiple times?

查看:456
本文介绍了在PHP中,多次运行session_start()有什么害处吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大概有一些小的性能影响,但是还可以吗?

Presumably there's some tiny performance hit, but beyond that?

推荐答案

来自文档:

从PHP 4.3.3开始,在先前启动会话之后调用session_start()将导致级别E_NOTICE的错误.另外,第二个会话开始将被忽略.

As of PHP 4.3.3, calling session_start() after the session was previously started will result in an error of level E_NOTICE. Also, the second session start will simply be ignored.

所以不,它不会造成伤害",但是会引发错误.而且它正在发生的事实可能表明您在做某件事是不正确的,并且可能需要重新考虑代码的布局方式.

So no, it won't "cause harm", but it'll throw an error. And the fact that it's happening is probably an indicator that you're doing something incorrectly, and might need to re-think how your code is laid out.

这篇关于在PHP中,多次运行session_start()有什么害处吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆