我正在开发一个混合 php 和 Java 的应用程序。我需要通过 Java 将一些值注入到 php 会话中,但要做到这一点,我需要能够将 php 会话的值解析为一个集合。有没有一个库可以让我在 Java 中撤消 session_encode 在 php 中所做的事情?
您可以将 PHP 环境配置为以 WWDX 格式存储会话数据\n http://www.php.net/manual/en/session.configuration.php#ini.session.serialize-handler
\n\nsession.serialize_handler defines the name of the handler which is used to \n serialize/deserialize data. Currently, a PHP internal format (name php or php_binary) \n and WDDX are supported (name wddx). WDDX is only available, \n if PHP is compiled with WDDX support. Defaults to php.`\nRun Code Online (Sandbox Code Playgroud)\n\n关于WDDX:
\n\nThe 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 解析器:)\n http://www.google.com.ua/search?q=java+wddx+parser
\n\n当然,这个解决方案比仅仅编写简单的解析器类 \xe2\x80\x93 更复杂,PHP 会话格式非常简单。
\n