Amfphp1.9 Non-beta related cases
1. Coding issues
Fatal error:uncaught exception ' verboseexception ' with message ' Cannot modify header information
Corrective measures:
Use ANSI encoding (this make up, conversion is troublesome) or UTF8 no BOM, not UTF8 with BOM
Save as UTF8 no BOM mode:
DW See: http://www.googlephp.cn/archives/tag/cannot-modify-header-information
Dzsoft:
In addition, modify the root directory under gateway.php (line127):
$gateway->setcharsethandler ("Utf8_decode", "iso-8859-1", "iso-8859-1"), and/or commented out, instead:
$gateway->setcharsethandler ("None", "iso-8859-1", "iso-8859-1");
2.NetStatusEvent
Flex/flash the newspaper:
Error #2044: Netstatusevent not processed:. Level=error, Code=netconnection.call.badversion
Corrective measures:
Root directory:
gateway.php (line 132)
if (production_server) {//disable Profiling, remote tracing, and service browser//$gateway->disabledebug ();//Comment it out/ /Keep The Flash/flex IDE player from connecting to the gateway. Used for security to stop remote connections.//$gateway->disablestandaloneplayer ();//Comment it out}
3.Save ByteArray to Mysql with Amfphp
As code:
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; var dat:bytearray = Jpegenc.encode (bpd); obj.pic = dat as Bytearray;return obj;} Private Function Onresult (e: *): Void{trace (e);}}}
PHP Code:
data; $data = mysql_real_escape_string ($data); $result =mysql_query ("INSERT into UserInfo (firstname,pic,addtime) VALUES (' $ps 1 ', ' $data ', ' $times ') '; return $result;}}? >
This can be stored in the MySQL database, but when returned to Flash or flex, there will be a convert error, then need to return before the map (class map) NEW: New ByteArray ();
Such as:
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 ');}}? >