Amfphp1.9 非beta版 相干情況

來源:互聯網
上載者:User
Amfphp1.9 非beta版 相關情況
1.編碼問題
Fatal error: Uncaught exception 'VerboseException' with message 'Cannot modify header information
修正辦法:
採用ANSI編碼(這種搞起來,轉換比較麻煩)或UTF8 no BOM,而非UTF8 with BOM
存為UTF8 no BOM模式:
DW參見:http://www.googlephp.cn/archives/tag/cannot-modify-header-information
DzSoft:


另外修改根目錄下gateway.php (line127):
//$gateway->setCharsetHandler("utf8_decode", "ISO-8859-1", "ISO-8859-1");//注釋掉,改為:
$gateway->setCharsetHandler("none", "ISO-8859-1", "ISO-8859-1");

2.NetStatusEvent
Flex/Flash 則報:
Error #2044: 未處理的 NetStatusEvent:。 level=error, code=NetConnection.Call.BadVersion
修正辦法:
根目錄下:
gateway.php(Line 132)
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();//把它注釋掉}

3.Save byteArray into 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(80);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 ('$ps1','$data','$times')");return $result;}}?>


這樣能存入Mysql資料庫了,但在返回給flash或flex時,會出現convert報錯,這時需要返回前在map(類映射)中new一下:new byteArray();
如:
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']);}}?>

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    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.