Php Symfony2与现有会话交互
我正在尝试从一个由Php Symfony2与现有会话交互,php,symfony,session,Php,Symfony,Session,我正在尝试从一个由PHP的本机会话启动的会话进行读写。我已经找到了关于它的信息,但实际上我无法与此会话进行交互。我使用了这两个文档: 如果我理解得很好,我应该能够在PhpBridgeSessionStorage启动后获取此会话的属性?如果是,我只得到一个空数组 我是这样编码的: 在我的app/config.yml中,我写了以下内容: 我使用的是Linux,读/写/tmp可能是权限问题吗?或者是我不理解文档,没有正确编写代码以使其交互 谢谢你的帮助 public function indexA
PHP
的本机会话启动的会话进行读写。我已经找到了关于它的信息,但实际上我无法与此会话进行交互。我使用了这两个文档:
如果我理解得很好,我应该能够在PhpBridgeSessionStorage
启动后获取此会话的属性?如果是,我只得到一个空数组
我是这样编码的:
在我的app/config.yml中,我写了以下内容:
我使用的是Linux
,读/写/tmp
可能是权限问题吗?或者是我不理解文档,没有正确编写代码以使其交互
谢谢你的帮助
public function indexAction(Request $request)
{
//I get my service, execute and then the session is created.
$phpCas = $this->container->get('phpcas');
$phpCas->execute();
// I start a new Session and display what's inside
$session = new Session();
$session->start();
$array = $session->all();
echo "<pre>";
print_r($array);
echo "</pre>";
return;
public function execute()
{
require_once __DIR__ . '/source/config.php';
ini_set('session.save_handler', 'files');
ini_set('session.save_path', '/tmp');
session_start();
phpCAS::setDebug();
phpCAS::client(SAML_VERSION_1_1, $cas_host, $cas_port, $cas_context);
phpCAS::setCasServerCACert($cas_server_ca_cert_path);
phpCAS::handleLogoutRequests(true, $cas_real_hosts);
//In forceAuthentication(), this is going to
start again a session and create a cookie.
phpCAS::forceAuthentication();
//I start a new phpBridgeSessionStorage to interact with this session
$session = new Session(new PhpBridgeSessionStorage());
$session->start();
}
session:
storage_id: session.storage.php_bridge
handler_id: ~
save_path: null