ã¯ããã«
ãæ¬é£è¼ã§ã¯ãPHPä¸ã§åä½ããã¢ããªã±ã¼ã·ã§ã³ãã¬ã¼ã ã¯ã¼ã¯ã§ããZend Frameworkã«ã¤ãã¦ç´¹ä»ãã¦ããã¾ããä»åã¯Adobe Flash Playerï¼ä»¥ä¸ãFlashï¼ã¨Zend Frameworkã®æ©æ¸¡ããããã¢ã¸ã¥ã¼ã«ãZend_Amfã®ç´¹ä»ããã¾ãã
ãZend_Amfã®AMFã¯Action Message Formatã®ç¥ã§ãFlashã¨ãµã¼ãã¨ã®éã§æ å ±ã®ããã¨ããããããã®ãã©ã¼ãããã§ããZend_Amfãå©ç¨ããã°ãæ軽ã«Flashããã®ãªã¯ã¨ã¹ããåããããå¦çã®çµæãè¿ãããã§ãã¾ãã
対象èªè
ãPHPã®åºæ¬æ§æã¯ä¸éãç解ãã¦ãããããã¬ã¼ã ã¯ã¼ã¯ãå©ç¨ãããã¨ã¯ãªãã¨ããæ¹ã対象ã¨ãã¦ãã¾ãã
å¿ è¦ãªç°å¢
ãZend Frameworkã¯PHP 5.2.3以éã¨Webãµã¼ããã¤ã³ã¹ãã¼ã«ããã¦ããç°å¢ã§å©ç¨å¯è½ã§ããæ¬ç¨¿ã§ã¯Webãµã¼ãã¨ãã¦Apache 2.2ããOSã«Windows XPãæ¡ç¨ããã¢ããªã±ã¼ã·ã§ã³ãä½æãã¦ããã¾ãã
ã以ä¸ã«ãä»åã¢ããªã±ã¼ã·ã§ã³ä½æï¼åä½ç¢ºèªã«ç¨ããç°å¢ã示ãã¾ãï¼ã¤ã³ã¹ãã¼ã«ã«ããã£ã¦ã¯ææ°å®å®çã®ä½¿ç¨ãæ¨å¥¨ãã¾ãï¼ãåé ç®ã®è©³ç´°ãªã¤ã³ã¹ãã¼ã«æé ã¯ãããµã¼ããµã¤ãæè¡ã®å¦ã³è - WINGSãããï½¢ãµã¼ããµã¤ãç°å¢æ§ç¯è¨å®æé ï½£ãåç §ãã ããã
- Windows XP SP2
- PHP 5.2.8
- Apache 2.2.11
ãLinuxãFreeBSDãªã©UNIXç³»OSã使ç¨ãã¦ããæ¹ãã³ãã³ãã¯ã»ã¼ä¸ç·ã§ãã®ã§ããã¹ãªã©ã¯é©å®èªã¿æ¿ãã¦ãã ããã
ãã¾ããä»åã®è¨äºã§ã¯Flex 3 SDKãå©ç¨ãã¦Flashã®ãµã³ãã«ãä½æãã¾ãããFlex 3 SDKã®ã¤ã³ã¹ãã¼ã«æ¹æ³ã«ã¤ãã¦ã¯ãæ¹ãã¦å¾è¿°ãã¾ãã
ããªããFlashã¢ããªã®éçºã«ã¤ãã¦ã¯æ¬ç¨¿ã®ç¯å²ãè¶ãã¦ãã¾ãã¾ãã®ã§ããã§ã¯æ±ãã¾ããããã¡ãã«ã¤ãã¦ã¯ã¢ããã®ãµã¤ãã«ãããã¥ã¼ããªã¢ã«ãåèã«ãªãã¨æãã¾ãããã®ãã¥ã¼ããªã¢ã«ã¯ãåºæ¬çã«ã¯Flexã®ããã®çµ±åéçºç°å¢ã§ããFlex Builderã®å©ç¨ãåæã«ãããFlashã¢ããªã®éçºã«ã¤ãã¦ã®è§£èª¬ã«ãªã£ã¦ãã¾ãã
ãæ¬ç¨¿ã§ä½¿ã£ã¦ããFlex 3 SDKãç¨ããã¢ããªã®éçºã«ã¤ãã¦ã¯ãè±èªã§ã®è§£èª¬ã«ãªãã¾ãããAdobe - Flex Developer Center: Quick Startsãåèã«ãªãã¾ãã
Zend_Amfã®åä½
ãZend_Amfã¯Flashããã®ãªã¯ã¨ã¹ããå¦çããã¢ã¸ã¥ã¼ã«ã§ããä»åã¯Flashããã®ããã¹ãåãåãããã®ããã¹ãã«ç¾å¨ã®æå»ããããã¦è¿ããµã³ãã«ãä½æãããã¨ã«ã¤ãã¦èãã¦ã¿ã¾ãããã®ããã«ãã¾ãFlashã¨Zend_Amfã®éã§ã®æ å ±ã®ããã¨ãã®æµãããè¦ã¦ããã¾ãããã
ãFlashããã®ãªã¯ã¨ã¹ããå®éã«å¦çããã®ã¯Zend_Amf_Server
ã¯ã©ã¹ã®ãªãã¸ã§ã¯ãã§ããFlashããéããã¦æ¥ããªã¯ã¨ã¹ããåãåãï¼å³1ï¼1ï¼ï¼ããªã¯ã¨ã¹ãã解æãé©åãªã¡ã½ãããé¸ã³ï¼å³1ï¼2ï¼ï¼ããã®ã¡ã½ããã«ããå¦çã®çµæãFlashã¸è¿ãã¾ãï¼å³1ï¼3ï¼ï¼ã
ãå®éã«å¦çãè¡ãã®ã¯ã¡ã½ããã¯ãé常ã¯Zend_Amf_Server
ã«ç»é²ãããå¤é¨ã®ãã®ã§ããå³1ã«å¯¾å¿ããå¦çã®æµããã³ã¼ã風ã«è¡¨ç¾ããã¨ãªã¹ã1ã®ããã«ãªãã¾ãã
$server = new Zend_Amf_Server(); //ï¼0ï¼å®éã«å¦çãããã¡ã½ããã®ç»é² $server->addFunction('é¢æ°1'); $server->addFunction('é¢æ°2'); ... //ï¼1ï¼ï¼2ï¼ãªã¯ã¨ã¹ãã®è§£æã¨å®éã®å¦ç $result = $server->handle(); //ï¼3ï¼å¦çã®çµæãè¿ã echo $result;
ããªããZend_Amf_Server
ã®ã¡ã½ããã®ãã¡ã主ãªãã®ãå
ã«ç´¹ä»ãã¦ããã¾ãã
åé¡ | ã¡ã½ããå | å¼æ° | 説æ |
ç»é² | setClass | $class, $namespace, $argv | $classã¯ã¯ã©ã¹åãªãããªãã¸ã§ã¯ãã§ã$classã®ã¡ã½ããå ¨ã¦ãAMFãå¦çããã¡ã½ããã¨ãã¦ç»é²ããã$namepsaceã¯AMFããå¼ã³åºãããéã®ãã¼ã ã¹ãã¼ã¹ã$argvã¯$functionãå¼ã³åºãããå ´åã«è¿½å ãããå¼æ°ã$namespaceã$argvã¯çç¥å¯è½ã |
addFunction | $function, $namespace,... | $functionã¯è¿½å ãããã¡ã½ããã®ååãªããã³ã¼ã«ããã¯é¢æ°ã$namespaceã¯AMFããå¼ã³åºãããéã®ãã¼ã ã¹ãã¼ã¹ããã以éã«å¼æ°ããã£ãå ´åã«ã¯ããããã®å¼æ°ã¯$functionãå¼ã³åºãããå ´åã«å¼æ°ã«è¿½å ãããã$namespace以éã¯çç¥å¯è½ã | |
addDirectory | $dir | ç»é²ããã¡ã½ãããå«ãã¯ã©ã¹ã®å®ç¾©ãã¡ã¤ã«ãæ ¼ç´ããã¦ãããã£ã¬ã¯ããª$dirã追å ããã | |
getDirectory | ï¼ãªãï¼ | ã¡ã½ãããæ ¼ç´ããã¦ãããã£ã¬ã¯ããªãé åã§è¿ãã | |
getFunctions | ï¼ãªãï¼ | ç»é²ããã¦ããã¡ã½ããã®é åãè¿ãã | |
listMethods | ï¼ãªãï¼ | ç»é²ããã¦ããã¡ã½ããã®ååã®é åãè¿ãã | |
å®è¡ | handle | $request | ã¯ã©ã¤ã¨ã³ãããåãåã£ãAMFãå¦çãããå¼æ°ã®$requestã¯çç¥å¯è½ã§ããã®å ´åã®å¤ã¯nullã |
ãã®ä» | setClassMap | $asClass, $phpClass | ã¢ã¯ã·ã§ã³ã¹ã¯ãªããï¼Flashã¢ããªå´ã®ã½ã¼ã¹ãã¡ã¤ã«ï¼ã®ã¯ã©ã¹$asClassã¨PHPã®ã¯ã©ã¹$phpClassã対å¿ã¥ããã |
setProduction | $flag | 製åçã¢ã¼ãï¼ã¨ã©ã¼ããã£ã¦ãç¡éã«åºåããªãã¢ã¼ãï¼ã«ããã | |
isProduction | ï¼å¼æ°ãªãï¼ | 製åçã¢ã¼ãã«ãªã£ã¦ããããè¿ãã |