Re: [問題] Flash接收PHP傳送的變數
爬文看到這篇文章
但實際測試檔案好像還是無法在flash抓到php要傳的值
能否請懂得flash與php傳值的板友
幫我看一下是哪個地方寫錯了呢?
謝謝
以下附上連結及程式碼(大部分是複製zswolf/MrMarcus兩位大大的文章內容)
(以flash 8製作)
http://tfgcamille.myweb.hinet.net/temp/test.rar
[php內容]
<?
$a="Hic";
$returnToFlash = "reply_txt=".$a;
echo mb_convert_encoding($returnToFlash, "UTF-8", "BIG5");
?>
[flash AS內容]
var myEntries = new LoadVars();
myEntries.load("http://localhost/test.php?=");
myEntries.onData = function(success) {
if (success) {
trace(this.reply_txt);
//有放一個變數名為 reply_txt 的動態文字區塊
for(i in this) trace(i + '=' + this[i]);
} else {
reply_txt.text = "not yet";
}
};
[輸出結果]
undefined
onData=[type Function]
※ 引述《MrMarcus (請勿忘記密碼)》之銘言:
: ※ 引述《zswolf (響徹雲霄的喇叭聲)》之銘言:
: : 小弟最近想動手寫留言版
: [del]
: : PHP的部分:
: : <?
: : $a="pio";
: : $returnToFlash = "reply_txt=".$a;
: : echo $returnToFlash;
: : ?>
: : Flash的部分
: : var myEntries = new LoadVars();
: : myEntries.load("http://localhost/eztest/ez.php?=");
: : myEntries.onLoad = function(success) {
: : if (success) {
: : trace(returnToFlash);
: 上面這行改成 trace(this.reply_txt); 才對。
: 可以在這裡加上下面這行檢視接收到的資料:
: for(i in this) trace(i + '=' + this[i]);
: : //有放一個變數名為 reply_txt 的動態文字區塊
: : } else {
: : reply_txt.text = "not yet";
: : }
: : };
: [del]
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 218.166.75.62
討論串 (同標題文章)
Flash 近期熱門文章
PTT數位生活區 即時熱門文章