加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

Flash(AS2.0)与php通讯 分享

发布时间:2020-12-15 06:28:59 所属栏目:百科 来源:网络整理
导读:不好意思,贴上瘾了,没想到flash+php+mysql这么顺利就搞定了,自己赏跟白沙,哈哈Flash代码://第一桢var sendLoad:LoadVars = new LoadVars();var acceptLoad:LoadVars = new LoadVars();sendLoad.userName = "Billows";sendLoad.sendAndLoad("../php/conn_db.p
不好意思,贴上瘾了,没想到flash+php+mysql这么顺利就搞定了,自己赏跟白沙,哈哈Flash代码://第一桢var sendLoad:LoadVars = new LoadVars();var acceptLoad:LoadVars = new LoadVars();sendLoad.userName = "Billows";sendLoad.sendAndLoad("../php/conn_db.php",acceptLoad,"POST");//sendLoad.sendAndLoad("http://localhost/Flash&PHP/php/conn_db.php","POST");acceptLoad.onLoad = function(success) { if (success) { var myText = _root.createTextField("Billows",100,100); myText.html = true; myText.htmlText = this.data; }};flash里和上面的差不多,这里用比较方便的LoadVars类来实现PHP代码:<?php$ userName = $ _POST['userName'];//Flash里传过来的值$ queryStr="SELECT * FROM username where name='".$ userName."'";//根据此变量查询mysql里数据mysql_connect("localhost","root","");//localhost本地数据库//root用户名//""密码mysql_select_db("test");//选择mysql里数据库$ qr = mysql_query($ queryStr);//执行查询$ nrows = mysql_num_rows($ qr); //取到符合查询条件的表里总的记录数for ($ i=0; $ i < $ nrows; $ i++){$ row = mysql_fetch_array($ qr); //取出数组$ data = $ row['password'].",".$ row['name']." "; //取出记录echo "&data=".urlencode($ data)."&";//输出到Flash}?>至于数据库我也接触的少,如果sql用的不熟的话,Mysql数据库,表,字段的建立可以用MySql-front来借助实现,很方便的。好了,php研究至此,以后要用的时候在研究吧。

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读