日期:2014-05-17 浏览次数:20462 次
if(PRODUCTION_SERVER) { //Disable profiling, remote tracing, and service browser //$gateway->disableDebug();//把它注释掉 // Keep the Flash/Flex IDE player from connecting to the gateway. Used for security to stop remote connections. //$gateway->disableStandalonePlayer();//把它注释掉 }
package { import flash.display.Sprite; import flash.net.NetConnection; import flash.net.ObjectEncoding; import flash.net.Responder; import flash.utils.ByteArray; import flash.display.BitmapData; public class Test extends Sprite { private var nc:NetConnection; private var rsp:Responder; public function Test() { rsp = new Responder(onResult,null); nc = new NetConnection( ); nc.objectEncoding = ObjectEncoding.AMF3; nc.connect("http://127.0.0.1/AmfphpForWareHouse/gateway.php"); nc.call("warehouse.MyPage.create",rsp,getData()); } public function getData():Object { var obj:Object=new Object(); obj.firstName = "diding"; var bpd:BitmapData = new BitmapData(a.width,a.height); bpd.draw(a); var jpegEnc:JPEGEncoder = new JPEGEncoder(80); var dat:ByteArray = jpegEnc.encode(bpd); obj.pic = dat as ByteArray; return obj; } private function onResult( e: * ):void { trace(e); } } }
<?php require_once "ConnectionHelper.php"; class MyPage{ public function create($contact) { $GLOBALS['amfphp']['encoding']='amf3'; $times=date("Y-m-d H:i:s"); $ps1=$contact['firstName']; $ba=$contact['pic']; $data = $ba->data; $data = mysql_real_escape_string($data); $result=mysql_query("INSERT INTO userinfo (firstname,pic,addTime)VALUES ('$ps1','$data','$times')"); return $result; } } ?>
<?php class AppVO { var $_explicitType ="vo.AppVO"; var $id; var $userName; var $email; var $phone; var $address; var $pic; public function AppVO(){} public function mapObject($obj) { $this->id = $obj['id']; $this->userName = $obj['username']; $this->email = $obj['email']; $this->phone = $obj['phone']; $this->address = $obj['address']; $this->pic =new ByteArray($obj['pic']); } } ?>