php 接 flash 的值並寫入資料庫

像這樣準備把資料丟給php
  1. var sendData:URLVariables = new URLVariables();   
  2. //要接收資料的php   
  3. var myRequest:URLRequest = new URLRequest("update.php");   
  4. myRequest.method=URLRequestMethod.POST;   
  5. var phpLoader:URLLoader = new URLLoader();   
  6. phpLoader.dataFormat = URLLoaderDataFormat.VARIABLES;  

然後把值給丟出去
  1. sendData.outputData=outputData;   
  2. sendData.mapid=mapId;   
  3. myRequest.data = sendData;   
  4. myRequest.method = URLRequestMethod.POST;   
  5. phpLoader.addEventListener(Event.COMPLETE, onSendComplete);    
  6. phpLoader.load(myRequest);  

  1. function onSendComplete(event:Event): void  
  2. {   
  3.       
  4. }  

然後php把值接到,就可以把值給寫到資料庫了。
  1. $data=$_POST['outputData'];   
  2. $id=$_POST['mapid'];  

留言