Java:PHP:RPC Losing Session Variable in between scripts
I have two java services listening on different ports and I am communicating with PHP scripts via RPC (Thrift)
login.php collects a username variable via POST and allows passage into home.php where the following happens
$user = $_SESSION['username'];
$result = thriftclient->callM开发者_高级运维ethodFromFirstJavaService();
echo $user;
echo $result;
Result gets printed out fine and the username gets printed out with no problem. So my session variable is not empty.
home.php also has a form that also collects another variable again via post
The next file profile.php activates the second java service which listens on a different port.
$val = $_POST['val']
$user = $_SESSION['username'];
$result = thriftclient->callMethodFromSecondJavaService($val);
echo $user;
echo $result;
This time the right result gets printed out again (so the second service was called OK...and the $_POST variable was unaffected between home and profile) but $user keeps returning as null.
Is there something peculiar to SESSION variables that would cause them to be lost when POST variables aren't.
I am putting session_start(); at the top of the file before any output!
Thanks for all help.
精彩评论