发表评论
◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。
package{
import flash.display.Sprite;
import flash.display.MovieClip;
import flash.display.Loader;
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.events.TimerEvent;
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.net.URLVariables;
import flash.net.navigateToURL;
import flash.net.URLRequestMethod;
import flash.net.URLLoaderDataFormat;
public class Json extends Sprite{
public function Json(){
var request:URLRequest = new URLRequest("http://localhost:8080/t.php");
request.method = URLRequestMethod.GET;
var loader:URLLoader = new URLLoader();
loader.dataFormat = URLLoaderDataFormat.VARIABLES;
loader.addEventListener(Event.COMPLETE, completeHandler);
loader.load(request);
}
private function completeHandler(evt:Event) {
trace(evt.target.data);
trace(evt.target.data.username);
}
}
}
<?php
$value = "username=biuuu&email=biuuu@gmail.com";
echo $value;
?>
方式2:
package{
import flash.display.Sprite;
import flash.display.MovieClip;
import flash.display.Loader;
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.events.TimerEvent;
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.net.URLVariables;
import flash.net.navigateToURL;
import flash.net.URLRequestMethod;
import flash.net.URLLoaderDataFormat;
public class Json extends Sprite{
public function Json(){
var request:URLRequest = new URLRequest("http://localhost:8080/t.php");
request.method = URLRequestMethod.GET;
var loader:URLLoader = new URLLoader();
loader.dataFormat = URLLoaderDataFormat.TEXT;
loader.addEventListener(Event.COMPLETE, completeHandler);
loader.load(request);
}
private function completeHandler(evt:Event) {
var xmlData:XML=XML(evt.target.data);
trace(xmlData.pic[0].@title);
}
}
}
<?php
$value = '<images><pic id="1" title="哈里波特哈里波特1" desc="哈里波特哈里波特哈里波特哈里波特哈里波特哈里波特哈里波特哈里波特1" src="http://l.yimg.com/g/images/home_photo_megansoh.jpg" link="http://www.baidu1.com/"/><pic id="2" title="哈里珀特2哈里珀特2" desc="哈里珀特2哈里珀特2哈里珀特2哈里珀特2哈里珀特2哈里珀特2哈里珀特2" src="assets/2.jpg" link="http://www.baidu2.com/"/><pic id="3" title="泡泡糖3泡泡糖3" desc="泡泡糖3泡泡糖3泡泡糖3泡泡糖3泡泡糖3泡泡糖3泡泡糖3泡泡糖3" src="assets/3.jpg" link="http://www.baidu3.com/"/><pic id="4" title="泡泡糖4泡泡糖" desc="泡泡糖4泡泡糖4泡泡糖4泡泡糖4泡泡糖4泡泡糖4泡泡糖4泡泡糖4泡泡糖4" src="assets/4.jpg" link="http://www.baidu4.com/"/><pic id="5" title="泡泡糖5泡泡糖" desc="泡泡糖5泡泡糖5泡泡糖5泡泡糖5泡泡糖5泡泡糖5泡泡糖5泡泡糖5" src="assets/5.jpg" link="http://www.baidu5.com/"/><pic id="6" title="中秋快乐中秋快乐6" desc="中秋快乐中秋快乐中秋快乐中秋快乐中秋快乐中秋快乐6" src="assets/6.jpg" link="http://www.baidu6.com/" /></images>';
echo $value;
?>
◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。