Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
当我看到来自 phpinfo() 的信息时,session.hash_function值是0,这意味着会话哈希函数是MD5,对吗?
session.hash_function
0
MD5
但结果echo strlen( session_id() );是26。
echo strlen( session_id() );
问题:为什么 是26而不是 32?
您设置的 session.hash_bits_per_character 越高,您的 session_id 就越短,因为每个字符使用更多位。可能的值为 4、5 或 6。
当使用 sha-1 进行散列时(通过设置 ini_set('session.hash_function', 1),以下会话字符串长度由三个 session.hash_bits_per_character 设置生成: