PHP会话ID字符串的长度是多少? [英] What is the length of a PHP session id string?
问题描述
我正在MySQL数据库中创建一个表,以保存一些会话数据,包括session_id
. VARCHAR
用来存储session_id
字符串的长度应该是多少?
I'm making a table in a MySQL database to save some session data, including session_id
. What should be the length of the VARCHAR
to store the session_id
string?
推荐答案
取决于 session.hash_function 和 session.hash_bits_per_character .
查看 session_id 页面以获取更多信息.
Check out the session_id page for more info.
您将session设置得越高.hash_bits_per_character越短 通过使用每个字符更多的位,session_id将变为.可能的 值是4、5或6.
The higher you set session.hash_bits_per_character the shorter your session_id will become by using more bits per character. The possible values are 4, 5, or 6.
使用sha-1进行哈希处理时(通过设置 ini_set('session.hash_function',1)以下会话字符串 长度由三个会话产生. 设置:
When using sha-1 for hashing (by setting ini_set('session.hash_function', 1) the following session string lengths are produced by the three session.hash_bits_per_character settings:
4-40个字符串
5-32个字符串
6-27个字符串
这篇关于PHP会话ID字符串的长度是多少?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!