简体   繁体   中英

as3 php variables

as3 code:

public function exists(uid:String):void {
        request = new URLRequest("http://localhost/index.php");
        request.method = URLRequestMethod.POST;

        variables = new URLVariables();
        variables.uid = uid;
        request.data = variables;

        loader = new URLLoader();
        loader.dataFormat = URLLoaderDataFormat.VARIABLES;
        loader.addEventListener(Event.COMPLETE, urlLoader_existsHandler);
        loader.load(request);
    }

    protected function urlLoader_existsHandler(event:Event):void {
        trace(event);
        //var variables:URLVariables = URLLoader(event.target).data;
        //trace(variables);
        //trace(variables.success);
    }

PHP output is

success=1&registration_id=1

Error is:

错误图片

Use the TEXT format instead of VARIABLES

loader.dataFormat = URLLoaderDataFormat.TEXT;

Here are the relating docs:

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/URLLoader.html#dataFormat

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM