php 字符串到 flash 变量
我在一个项目中使用 AS3,我必须将一些 flash 变量发送到 PHP,检查 MySQL 数据库并将一些结果返回到 Flash。我这样做是这样的: new URLRequest(URL + "?p=" + SelectedCountry + "&action=check&nocache=" + Math.floor(Math.random() * (10000000)));
和 php代码只是检查 MySQL 是否存在包含所选国家/地区的行:
if($_REQUEST['action'] == "check") {
$q = mysql_query("SELECT * FROM myDB WHERE country = '".$_REQUEST['p']."'");
if(mysql_num_rows($q) == 0) {
echo "nqma";
} else {
echo "ima";
}
}
好的,这很好,它可以工作,因为我可以在 Flash 中使用它:
if(e.target.data == "ima") {
uiRepCountryLabel.text = "Ima";
}
if(e.target.data == "nqma") {
uiRepCountryLabel.text = "Nqma";
}
但是如果我想让 php 结果看起来像这样怎么办:
if($_REQUEST['action'] == "check") {
$q = mysql_query("SELECT * FROM myDB WHERE country = '".$_REQUEST['p']."'");
if(mysql_num_rows($q) == 0) {
echo "res=nqma";
} else {
echo "res=ima&hisCountry=Bulgaria&hisPhoneNumber=000000123&hisCity=Svishtov&his.....";
}
}
如何我可以在 Flash 中使用这种格式吗?我知道,你们中的许多人会告诉我使用 AMFPHP,但我不能,因为我的客户不想这样做。
I am using AS3 for a project and I have to send some flash variables to PHP, check the MySQL databese and the to return some results to Flash. I do this with this:new URLRequest(URL + "?p=" + SelectedCountry + "&action=check&nocache=" + Math.floor(Math.random() * (10000000)));
and the php code just checks the MySQL if there is a row with the selected country:
if($_REQUEST['action'] == "check") {
$q = mysql_query("SELECT * FROM myDB WHERE country = '".$_REQUEST['p']."'");
if(mysql_num_rows($q) == 0) {
echo "nqma";
} else {
echo "ima";
}
}
OK, that's fine and it works, because I can use this in Flash:
if(e.target.data == "ima") {
uiRepCountryLabel.text = "Ima";
}
if(e.target.data == "nqma") {
uiRepCountryLabel.text = "Nqma";
}
But what if I want to make the php result to look like this:
if($_REQUEST['action'] == "check") {
$q = mysql_query("SELECT * FROM myDB WHERE country = '".$_REQUEST['p']."'");
if(mysql_num_rows($q) == 0) {
echo "res=nqma";
} else {
echo "res=ima&hisCountry=Bulgaria&hisPhoneNumber=000000123&hisCity=Svishtov&his.....";
}
}
How can I use this format In Flash? I know, that many of you will tell me to use AMFPHP, but I am not able, because my client doesn't want to.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
像这样的东西:
Something like this:
您可以将其添加到 Crooksy 的帖子中:
You could add this to crooksy's post: