ÔÚFlashÓ¦Óÿª·¢ÖУ¬¾³£ÐèÒªÓõ½ºÍWeb·þÎñÆ÷¶ËµÄͨÐÅ,°Ñµ±Ç°µÄÓ¦ÓóÌÐò״̬´æ´¢µ½·þÎñÆ÷ÉÏ»òÕß´Ó·þÎñÆ÷¶Ë»ñÈ¡ÐÅÏ¢µÈµÈ¡£¶ÔÓÚFlashÀ´ ˵£¬ËûÒѾÌṩÁ˶ÔHttpÐÒéºÍÍøÂçÌ×½Ó×Ö(Socket)µÄÖ§³Ö¡£¶ÔÓÚHttpÐÒéµÄÖ§³Ö£¬Flashͨ¹ýURLRequest¡¢ URLLoader¡¢URLVariablesµÈÀàÀ´Íê³É²Ù×÷¡£
1¡¢FlashÖлñÈ¡ÍⲿͼƬµÈ×ÊÔ´
ÔÚActionScript3ÖУ¬»ñÈ¡Íⲿ×ÊÔ´Ö÷Ҫͨ¹ýURLRequestºÍURLLoaderÁ½¸öÀàÍê³É£¬¿ÉÒÔͨ¹ý×¢²áURLLoaderÀàµÄCompleteºÍProgressµÈʼþÀ´¼à¿Ø»ñÈ¡Íⲿ×ÊÔ´µÄ״̬¡£
var myLoader:URLLoader=new URLLoader(); var myXmlLocation:URLRequest = new URLRequest("test.xml"); myLoader.load(myXmlLocation); myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,xmlLoadComplete);
Èç¹ûÎÒÃÇ»ñÈ¡µÄÍⲿ×ÊÔ´ÊǶþ½øÖÆÐÎʽµÄ£¬ÎÒÃÇÐèҪʹÓÃLoaderÀàÀ´´úÌæURLLoaderÀà¡£
2¡¢FlashÖеÄÐÅÏ¢´«Êä¸øWeb·þÎñÆ÷
ÔÚFlashÖÐÐèÒª°ÑÊý¾Ý´«µÝ¸øWeb·þÎñÆ÷£¬ÎÒÃÇÖ»ÄÜͨ¹ýPOST»òÕßGET½øÐÐ,POST¶¯×÷Ïà¶ÔÓÚGET¿ÉÒÔ´«µÝ¸ü¶àµÄÊý¾Ý£¬¾ßÌåÇø±ðÔÚÓÚ HttpµÄentity body£¬¶ÔÓÚPOSTÀ´Ëµ£¬·¢Ë͵ÄÖµ¾ÍÔÚentity bodyÖУ¬¶ÔÓÚGETÀ´Ëµ£¬entity bodyÓÀԶΪ¿Õ¡£¶ÔÓÚHTML±íµ¥£¬¿ÉÒÔÔÚFormµÄMethodÖÐÖ¸Ã÷µ±Ç°´«µÝÊý¾ÝÊÇPOST»¹ÊÇGET£¬µ«ÊÇFlashÖУ¬ÐèÒªÔÚ URLRequest¶ÔÏñÖÐÖ¸Ã÷µ±Ç°µÄ²Ù×÷ÊÇPOST»¹ÊÇGET¡£ÔÚFlashÖУ¬µ±ÐèÒª¸øWeb·þÎñÆ÷´«µÝÊý¾Ýʱ£¬ÐèÒªURLRequest£¬URLVariables£¬URLLoaderµÈÈý¸öÀàÀ´Íê³É¡£
var values:URLVariables =new URLVariables(); values.key=¡±Message¡±; var header:URLRequestHeader = new URLRequestHeader("pragma", "no-cache"); var request:URLRequest=new URLRequest("http://localhost/shopguide/data.php"); request.data=values; request.requestHeaders.push(header); request.method=URLRequestMethod.POST; var loader:URLLoader=new URLLoader(); try { loader.load(request); } catch (error:ArgumentError) { trace("An ArgumentError has occurred."); } catch (error:SecurityError) { trace("A SecurityError has occurred."); }
ÉÏÃæµÄ´úÂ룬ÀûÓÃURLVariables¹¹Ôì³öÒª´«µÝÊý¾ÝµÄ¼üÖµ¶Ô£¬ÕâÑùÔÚPHP¶Ë£¬¾Í¿ÉÒÔͨ¹ý$_POST[¡°key¡±]À´»ñÈ¡´«µÝµÄÊý¾Ý¡£´ú ÂëÖеÄURLRequestHeadereÊÇÒ»¸öHttpÇëÇóÍ·£¬¼´Ê¹Ó¦ÓóÌÐò¾ßÓÐËùÇëÇóÄÚÈݵĻº´æ¸±±¾£¬Ò²Ó¦µ±½«ÇëÇóת·¢¸øÔʼ·þÎñÆ÷¡£ÏÂÃæµÄͼÊÇÔÚ IE9µÄ¿ª·¢ÈËÔ±¹¤¾ßÏ¿´µ½µÄÇëÇóÐÅÏ¢¡£
ÔÚPHP·þÎñ¶Ë£¬ÎÒÃÇÖ»ÐèÒªecho($_POST['key']);¾Í¿ÉÒÔ»ñÈ¡µ½ÇëÇóµÄÐÅÏ¢£¬µÚÈý·ùͼµÄÏìÓ¦ÕýÎľÍÊÇPHPÖÐechoÊä³öµÄÐÅÏ¢¡£
3¡¢Ê¹ÓÃphp://input»ñȡûÓÐÖ¸¶¨¼üÖµ¶ÔµÄFlashÇëÇóµÄÄÚÈÝ
ÔÚ¡¶ACTIONSCRIPT 3.0±à³Ì¡·Õâ±¾ÊéÖУ¬Ëû¸ø³öµÄÒ»¸ö´«µÝXMLµÄµ½Web·þÎñÆ÷µÄÀý×Ó²¢Ã»ÓÐʹÓÃURLVariablesÀàÀ´¹¹½¨¼üÖµ¶Ô£¬Ê¾Àý´úÂëÈçÏ£º
var secondsUTC:Number = new Date().time; var dataXML:XML = <login> <time>{secondsUTC}</time> <username>Ernie</username> <password>guru</password> </login>; var request:URLRequest = new URLRequest("http://localhost/shopguide/data.php"); request.contentType = "text/xml"; request.data = dataXML.toXMLString(); request.method = URLRequestMethod.POST; var loader:URLLoader = new URLLoader(); try { loader.load(request); } catch (error:ArgumentError) { trace("An ArgumentError has occurred."); } catch (error:SecurityError) { trace("A SecurityError has occurred."); }
Õâ¸ö´úÂë·¢Ë͵ÄÇëÇóÓëʹÓÃURLVariablesÀàµÄ²îÒìÔÚÓÚÇëÇóµÄÄÚÈÝÖ±½ÓÊÇ·¢Ë͵ÄÄÚÈÝ£¬¾ÍÊÇûÓмüÖµ£¬ÇëÇóµÄÄÚÈÝÈçÏ£º
ÏñÕâÑùµÄÇëÇóÈçºÎÔÚPHPÖÐÈ¡µÃÊý¾Ý£¿ºóÀ´²é×ÊÁϵÃÖª£¬¿ÉÒÔͨ¹ýPHPµÄfile_get_contents("php://input")»ñÈ¡¡£ ÔÚPHPÖУ¬file_get_contents·µ»ØµÄÊÇÒ»¸ö×Ö·û´®¡£Í¨¹ýÊä³öfile_get_contentsµÄÄÚÈÝÎÒÃÇ¿ÉÒÔ¿´µ½ÈçÏÂÏìÓ¦ÕýÎÄ¡£
¹ØÓÚphp://input£¬Çë²Î¿¼ÕâƪÎÄÕ£º
php://inputÊÇʲôÒâ˼?phpÊäÈëÁ÷inputµÄ½éÉÜ
ActionsScript3Öл¹ÌṩÁËSocketÀàºÍXMLSocketÀ࣬¾ßÌåʹÓÿÉÒԲο¼¡¶ ACTIONSCRIPT 3.0±à³Ì¡·Õâ±¾Êé¡£
ÍƼöÐÅÏ¢
- ¡¾ÊÓƵ²¥·Å¡¿JplayerÊÓƵ²¥·ÅÆ÷µÄʹÓÃ
- memcacheÄÚ´æÔÀí
- Memcache¼¼Êõ·ÖÏí£º½éÉÜ¡¢Ê¹Óᢴ洢¡¢Ëã·¨¡¢ÓÅ»¯....
- php³£ÓÃÕýÔò±í´ïʽ
- phpÐÔÄܼà²âÄ£¿éXHProf
- ÈÃCI¿ò¼ÜÖ§³Öservice²ã
- ʹÓÃPHPÉú³É´øLOGOµÄ¸öÐÔ»¯¶þάÂëͼÏñ
- ¹ØÓÚCodeIgniterÄã¿ÉÄܲ»ÖªµÀµÄ5¸ö֪ʶµã
- Memcache ºÁÃ뼶³¬Ê±¼°ÆäËû³£¼ûÎÊÌâ»ã×Ü
- [PHP±Ê¼Ç]PHPQueryÒ»¸ö´¦ÀíDOMµÄÀûÆ÷
ÈÈÃÅÐÅÏ¢
- nohup: redirecting stderr to stdou....
- ʹÓÃlog_formatΪNginx·þÎñÆ÷ÉèÖøüÏêϸµÄÈÕÖ¾¸ñʽ
- jquery easyUI--dataGrid-Json
- [Ô´´]·ÂGoogle Reader¡¢ÐÂÀË΢²©¡¢ÌÚѶ΢²©µ....
- ÀûÓÃKeepalived+mysql¹¹½¨¸ß¿ÉÓÃMySQLË«Ö÷×Ô¶....
- Nginx+keepalivedʵÏÖ¸ºÔؾùºâºÍË«»úÈȱ¸¸ß¿ÉÓÃ
- jqueryʵÏÖÒ³Ãæ¼ÓÔؽø¶ÈÌõ
- Rolling cURL: PHP²¢·¢×î¼Ñʵ¼ù
- codeigniter ·ÓÉÖÕ¼«ÓÅ»¯(url rewrite)
- linuxÏÂÉèÖÃsshÎÞÃÜÂëµÇ¼
×î½ü¸üÐÂ
- PHP»ñÈ¡Óû§µÄÕæʵIP£¬²¢ÅжÏÊÇ·ñÄÚÍøIP
- PHP ´íÎóÈÕÖ¾ error_log
- ÀûÓÃbigpipe»úÖÆʵÏÖÒ³ÃæÄ£¿éµÄÒì²½äÖȾ chunked¼¼Êõ
- php¿ØÖÆÎļþÏÂÔØËÙ¶È
- js + php ¶ÁÈ¡¡¢²¥·ÅÊÓƵÁ÷ ¼æÈÝfirefox£¬c....
- ¡¾ÊÓƵ²¥·Å¡¿JplayerÊÓƵ²¥·ÅÆ÷µÄʹÓÃ
- UNICODE Óë UTF-8 µÄ¹Øϵ
- memcacheÄÚ´æÔÀí
- Memcache¼¼Êõ·ÖÏí£º½éÉÜ¡¢Ê¹Óᢴ洢¡¢Ëã·¨¡¢ÓÅ»¯....
- phpʹÓÃmb_detect_encoding¼ì²â×Ö·û´®±àÂë
ÆÀÂÛ