有点奇怪的问题,但我在项目中经常使用 session 。
如果我在一个页面中重复使用它们,最好将它们读入变量一次,然后使用该变量,或者不断引用 $_SESSION['name']
没有什么区别吗?在同一页面?
最佳答案
Does using sessions too much slow down performance in PHP?
不。
does it make no difference to be constantly referencing $_SESSION['name'] in the same page?
这确实没有什么区别。
is it better to read them in to a variable
你知道,$_SESSION['name'] 已经是一个变量了。
关于php - 过多使用 session 是否会降低 PHP 的性能?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7835519/