php 如何重命名 PHPSESSID?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/964272/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 00:30:24  来源:igfitidea点击:

How to rename PHPSESSID?

php

提问by Alec Smart

Wondering how I can change the php session id from PHPSESSID to something else so that it does not interfere with other PHP scripts running on the same domain. Is this possible?

想知道如何将 php 会话 id 从 PHPSESSID 更改为其他内容,以便它不会干扰在同一域上运行的其他 PHP 脚本。这可能吗?

Thank you for your time

感谢您的时间

回答by PatrikAkerstrand

See this link for PHP runtime configuration. The variable you are looking for is session.name. You can also alter this programmatically by calling session_namebefore any call to session_startor session_register.

有关PHP 运行时配置,请参阅此链接。您正在寻找的变量是session.name。您还可以通过在调用session_startsession_register之前调用session_name以编程方式更改此设置。

回答by Robert K

session_name('mySessionName');
session_start();

Try looking at PHP's reference.

尝试查看PHP 的参考