可以通过更改 factory.yml 中的设置将用户会话存储在数据库中:
all:
storage:
class: sfMySQLSessionStorage
param:
db_table: session # Name of the table storing the sessions
database: propel # Name of the database connection to use
# Optional parameters
db_id_col: sess_id # Name of the column storing the session id
db_data_col: sess_data # Name of the column storing the session data
db_time_col: sess_time # Name of the column storing the session timestamp
从给出的示例中,似乎表中的列仅限于几个预定义的列。这意味着无法存储 Symfony 未预料到的其他信息,例如 ip 地址。
是否可以扩展数据库架构以包含更多自定义列?