Setting PHP session variables using Flash Actionscript

前端 未结 2 1575
不知归路
不知归路 2020-12-08 09:07

I have a simple PHP upload script that is called from my Flash App. I am sure it makes the call because it actually uploads the file!

session_start();

$defa         


        
2条回答
  •  感动是毒
    2020-12-08 09:10

    Every time a web server provides you with a response ( a page, a graphic, etc. ) it has the opportunity to send your browser a cookie.

    1) Each cookie is only sent back to the same web site as it came from in the first place 2) The "contents" of the cookie( the data it contains) can only be made up of whatever information the web server already knew anyway.

    So your browser automatically send cookies in "Cookie" variable in HTTP header. You can read it with folowing command in PHP:

    $headers = apache_request_headers();
    echo $headers['Cookie'];
    

    Server ( if session support enabled in PHP configuration ) automatically creates PHPSESSID ( you can modify variable name in configuration ) in a cookie and you can access it directly with above script ( you need to parse $headers in order to get PHPSESSID variable or any other cookie). I think there is no need to use flashvars, your browser automatically add Cookie variable in HTTP header.

    Hope this helps !

提交回复
热议问题