是否有用于解码php会话数据的Java库?

时间:2010-12-29 16:35:49

标签: java php session

我正在开发一个混合了php和Java的应用程序。我需要通过Java向php会话中注入一些值,但为了做到这一点,我需要能够将php会话的值解析为一个集合。是否有一个库可以让我在Java中撤消session_encode在php中做什么?

1 个答案:

答案 0 :(得分:2)

您可以配置PHP环境以WWDX格式存储会话数据 http://www.php.net/manual/en/session.configuration.php#ini.session.serialize-handler

session.serialize_handler defines the name of the handler which is used to 
  serialize/deserialize data. Currently, a PHP internal format (name php or php_binary) 
  and WDDX are supported (name wddx). WDDX is only available, 
  if PHP is compiled with WDDX support. Defaults to php.`

关于WDDX:

The Web Distributed Data Exchange, or WDDX, is a free, open XML-based technology that allows Web applications created with any platform to easily exchange data with one another over the Web.

通过谷歌搜索可以获得Java WDDX Parser :) http://www.google.com.ua/search?q=java+wddx+parser

当然,这个解决方案比编写简单的解析器类更复杂 - PHP会话格式非常简单。