什么是framework.session.storage_id的有效值? [英] What are valid values for framework.session.storage_id?

查看:105
本文介绍了什么是framework.session.storage_id的有效值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Symfony配置中,有一个条目 framework.session.storage_id 。此设置还会显示在 Symfony配置文档的默认配置中,但它没有解释。我的假设是它定义了会话数据在服务器端的存储位置。

In the Symfony configuration there is an entry framework.session.storage_id. This setting also appears in the default config on the Symfony configuration documentation but it is not explained. My assumption is that it defines where session data is stored on the server side.

我在此项中看到的值包括 session.storage.mock_file session.storage.native session.storage.filesystem 。我不确定这些值的确切含义(例如,模拟文件和文件系统之间的区别是什么?),并且还认为这不是可能值的完整列表。

Values I have seen for this entry include session.storage.mock_file, session.storage.native and session.storage.filesystem. I am unsure of what these values exactly mean (e.g. what is the difference between a mock file and a filesystem?) and also think that this is not the complete list of possible values.

那么此配置键究竟控制什么,什么值有效?

So what exactly does this configuration key control and what values are valid?

推荐答案

framework.session.storage_id 如下:


  • session.storage.mock_file -用于测试。

  • session.storage.filesystem -用于测试。它是 session.storage.mock_file 的别名。

  • session.storage.native -使用定义的会话处理程序的默认实现

  • session.storage.php_bridge -用于旧版应用程序

  • session.storage.mock_file - for testing. It doesn't start session at all.
  • session.storage.filesystem - for testing. It is an alias for session.storage.mock_file.
  • session.storage.native - default implementation using defined session handler
  • session.storage.php_bridge - for legacy apps

从开发人员的角度来看,有一个 session 服务可以抽象化会话的工作。 会话服务取决于某些会话存储服务会话存储从PHP的角度实现了会话管理(例如,调用 session_start()函数)。 存储还取决于某些会话处理程序 Handler \SessionStorage 的实现,它告诉您如何以及在何处物理存储会话。

From developer perspective, there is a session service that abstracts working with session. session service depends on some session storage service. Session storage implements session management from PHP perspective (calling session_start() function for example). Storage also depends on some session handler. Handler is implementation of \SessionStorage and it tells how and where will be session physically stored.

这三层design 允许创建存储进行测试,而根本不调用 session_start()并且不使用处理程序( session.storage.mock_file )。或创建可以在任何地方( session.storage.native )存储和加载会话的 handler session.storage.php_bridge 解决了以下情况: session_start()由外部PHP代码(而非Symfony )调用会话存储)。

This three layer design allows creating storage for testing which does not call session_start() at all and does not use handler (session.storage.mock_file). Or creating of handler that can store and load session from anywhere (session.storage.native). session.storage.php_bridge solves situation when session_start() is called by external PHP code (not by Symfony session storage).

我希望清楚理解。

这篇关于什么是framework.session.storage_id的有效值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆