php sessions and mobile applications
I'm developing application that would communicate with a mo开发者_运维技巧bile app. My problem is as follows - my mobile app doesn't accept any session data - no $_GET variables, no cookies - all communication in both sides is done with xml and I can't change it by, for example adding some parameters to xml, because mobile app would not understand those. Now, I would like to use php sessions - mobile app sends me a unique identifier which I can use as a session key. Will this work in an usual manner, like setting some variable in $_SESSION array, and then retrieving them in next request?
ps. I can't use database nor files...
You can use the session_id()
function to fetch the PHP session ID and somehow include that in the XML you send to the device, and then at the other end you can extract the unique identifier, call session_id({unique_parameter});
to set the session ID and then call session_start();
and you should be all set.
精彩评论