PHP: what is the purpose of session_name

前端 未结 2 1834
眼角桃花
眼角桃花 2020-12-06 04:06

I\'m not quite sure what the purpose of session_names is.. Can someone please explain in what circumstances defining a name would be beneficial?

相关标签:
2条回答
  • 2020-12-06 04:48

    The default is - I think - PHPSESSID. If you have more than one application on the same host, they would share those sessions. So, you should set different session names for each application, so that there is no weird stuff happening.

    0 讨论(0)
  • 2020-12-06 04:50

    You have two sites on the same domain. (say, a blog and a forum)

    They both run different pieces of software.

    If they ran on the same session and used the same variables in $_SESSION, (say, user_id), they would conflict.

    session_name lets you give each application a different session.

    0 讨论(0)
提交回复
热议问题