Home  >  Article  >  Backend Development  >  求助PHP中session与数据库的问题

求助PHP中session与数据库的问题

WBOY
WBOYOriginal
2016-06-23 14:26:51811browse

session 数据库 会话

请问
我在做登陆页面的时候,session已经取得数据库字段中的数据
我在页面中保持会话状态时,数据库连接需要关闭吗?
如果关闭了 会不会影响会话?

回复讨论(解决方案)

SESSION会话,存储在文本里时,和数据库连接没关系.
当SESSION存储在数据库里时,才会数据库连接有关系

也就是说
我现在可以关闭数据库连接吧
如果我要操作session读写数据库时 才需要再次打开数据库连接?

php操作数据库不属于长连接,脚本运行完毕,数据库自行关闭

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn