PHP 生成如下内容:
Set-Cookie: m+m=unttot9siteipcsrc0r064hn37; path=/
...并且浏览器(Firefox / 23)将其发回:
Cookie: m+m=unttot9siteipcsrc0r064hn37
到现在为止还挺好。但随后 PHP 会生成一个新的会话 ID:
Set-Cookie: m+m=7tmi7kd8n27ef3qdk5q706gk85; path=/
Is it a bug? I'd say it isn't since your session name is clearly invalid:
The session name references the name of the session, which is used in cookies and URLs (e.g. PHPSESSID). It should contain only
alphanumeric characters; it should be short and descriptive (i.e.
for users with enabled cookie warnings). If name is specified, the
name of the current session is changed to its value.
Warning
The session name can't consist of digits only, at least one letter must be present. Otherwise a new session id is generated every time.
If you follow the rules it works as expected:
session_name('mxm');
To sum up:
- Don't guess, use the browser developer console and other tools
- Read the docs ;-)
Edit: Just noticed you say this:
I can not find any hints on the manual page, nor a definition on what is valid characters for a session.
I found that information right in the manual page for session_name().