How can you share session information between PHP and Perl CGI?
I have a thirdparty script that I don't want to rewrite in CGI/Perl, so I was thinking, if I set some session information via PHP, there开发者_运维百科 must be a way to retrieve that same data with CGI. I'm not big on Perl, can you guys point me in the right direction?
//php
session_start();
$_SESSION['myvar']=1234;
So how do I access this with Perl/CGI?
Thanks!!!
PHP's default file-based session handler basically just writes out a serialize()
copy of the $_SESSION array. The file is usually named "sess_XXX" where XXX is the session ID. There's Perl libraries that let it read PHP's serialize format (http://hurring.com/scott/code/perl/serialize/ for one, from a quick googling).
If you get the session ID and session save path from PHP into Perl, it'll be trivial to read the session data in Perl.
精彩评论