Amfphp1.9 Non-beta coherence situation

Source: Internet
Author: User
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 ');}}? >

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.