首页 / PHP / AMFPHP跟PHP交互的小例子
AMFPHP跟PHP交互的小例子
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了AMFPHP跟PHP交互的小例子,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含2671字,纯文字阅读大概需要4分钟。
内容图文
![AMFPHP跟PHP交互的小例子](/upload/InfoBanner/zyjiaocheng/218/8141d64e40fa4f1ea6c324347218e037.jpg)
到这里下载AMFPHP for?FLASH8
的组件,如果你使用其他版本,请到这里选择下载:http://www.adobe.com/products/flashremoting/downloads/components/
下载后安装,完毕后打开Macromedia Flash 8,查看 “窗口|公用库|Remoting”就可以看到AMFPHP的组件了。
新建立一个工程,拖一个RemotingClasses组件到舞台的任何地方,再拖一个List组件,命名为myls,拖一个Button组件,命名为"mybt"
在第一帧的代码行复制以下代码:
import mx.remoting.*; import mx.rpc.*; import mx.utils.Delegate; import mx.remoting.debug.NetDebug; var gatewayUrl:String = "http://localhost/amfphp/gateway.php"; var service:Service; NetDebug.initialize(); service = new Service(gatewayUrl, null, "PersonService"); function getPerson() { trace("getPerson"); var pc:PendingCall = service.getPerson(); pc.responder = new RelayResponder(this, "handleGetPerson"); } function handleGetPerson(re:ResultEvent) { trace("handleGetPerson"); trace(re.result.getItemAt(0).name); _root.mytree.dataProvider = re.result; _root.mydg.dataProvider = re.result; } function onClick() { getPerson(); } mybt.addEventListener("click", Delegate.create(this, onClick));
在AMFPHP的SERVICES文件夹下新建一个文件,命名为PersonService.php
复制一下内容到PersonService.php
methodTable=array( "getPerson"=> array( "access"=>"remote" ) ); mysql_connect('localhost','root','wuliqunao'); mysql_select_db('test'); } function getPerson() { $sql="SELECT * FROM persons"; $query=mysql_query($sql); return $query; } } ?>
?好了,发布你的程序,单击Button按钮,看到结果:
当然了,你的本机需要有个MYSQL数据有,里面简历一个test数据库,这个库里面创建一个persons数据表,表里2个字段,一个是name,一个是age.(表告诉我,你搞不好这个库啊,搜一个MYSQL数据库入门教程,一下就知道啦。)
好了,大功告成,开始学习AMFPHP之路吧~~~~
php版顶起来--通信教程基础之sendToURL
http://bbs.actionscript3.cn/thread-8144-1-3.html
flash通信教程之URLLoader类1
http://bbs.actionscript3.cn/thread-8230-1-2.html
flash通信教程之URLLoader类2-从后台
http://bbs.actionscript3.cn/thread-8243-1-2.html
flash通信教程URLLoader类3?
http://bbs.actionscript3.cn/thread-8245-1-2.html
flash通信教程URLLoader类4
http://bbs.actionscript3.cn/thread-8246-1-2.html
flash通信教程URLLoader类5-xml?
http://bbs.actionscript3.cn/thread-8247-1-2.html
flash通信教程URLLoader类6
http://bbs.actionscript3.cn/thread-8248-1-2.html
flash通信教程URLLoader类7-request带数据
http://bbs.actionscript3.cn/thread-8249-1-2.html
php与flex互相通信的例子
http://bbs.actionscript3.cn/thread-10726-1-2.html
flash获取php中变量
http://bbs.actionscript3.cn/thread-6494-1-1.html
http://hi.baidu.com/pcbbt/blog/item/4018f64ecb9fa3dbd1c86ac1.html
http://www.51xflash.com/article/flashcs3/200812/14-8057.html
http://www.codehorde.com/thread-1628-1-1.html
内容总结
以上是互联网集市为您收集整理的AMFPHP跟PHP交互的小例子全部内容,希望文章能够帮你解决AMFPHP跟PHP交互的小例子所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。