看板 PHP 關於我們 聯絡資訊
※ [本文轉錄自 Flash 看板 #1GOM6BoD ] 作者: SouthernSun (撒燈尚) 看板: Flash 標題: [問題] sendToURL傳值給php失敗? 時間: Tue Sep 25 15:47:18 2012 參考網頁 http://ppt.cc/Y65d 我是想在網頁上的flash按鈕按下去後,網頁下方會出現"HELLO" 用這個成功 navigateToURL() 但我不想開啟新視窗..所以改用 sendToURL() 然後就失敗了!! Q_Q AS3===== var Server_URL:URLRequest = new URLRequest("Untitled-1.php"); var send_data:URLVariables = new URLVariables(); send_data.userPass = "HELLO"; Server_URL.data = send_data; Server_URL.method = URLRequestMethod.POST; sendToURL(Server_URL);//失敗 //成功="=// navigateToURL(Server_URL); PHP===== $hello = $_POST['userPass']; echo $hello; 附註==== 網頁遷入Flash <object type="application/x-shockwave-flash" data="b3.swf" width="700" height="700"> </object> 網頁一開啟就告訴我 Notice: Undefined index: userPass in L:\..\Untitled-1.php on line 56 按了按紐也一樣沒反應... 然後我swf和php檔都放在同一個資料夾~不懂為什麼會失敗="= 後來我在php裡面放上將值寫入文字檔的功能 $txt2 = fopen("testT2.txt","a"); fwrite($txt2,"$userPass"); fclose($txt2); 沒想到文字檔內確實記錄flash傳過去的值..神奇耶0.0 但不管我flash傳值按鈕怎麼按~網頁一點動靜也沒有,是因為我少了什麼 php頁面更新的function嗎@@? -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 114.40.177.252 ※ 發信站: 批踢踢實業坊(ptt.cc) ※ 轉錄者: SouthernSun (114.40.177.252), 時間: 09/25/2012 20:53:02
SouthernSun:第一次寫flash與php通信 Q_Q 不知道哪裡出了問題 09/25 20:54
terrybob:isset($_POST['userPass']) ? 09/25 21:58
terrybob:trim($_POST['userPass']) : ''; 09/25 21:58
kerash:樓上這樣只會造成他程式看起來OK但是會有問題 09/25 22:29
kerash:應該要先找出為什麼有傳卻收不到 userPass 值 09/25 22:30
kerash:你的URL給一個完整路徑試試看,不要用相對 09/25 22:31
SouthernSun:還是不行="= 09/25 22:41
terrybob:接收沒問題,就看傳送方式有沒有問題了…FLASH無法幫 09/25 23:35
SouthernSun:ok我在檢查看看flash 09/25 23:40
※ 編輯: SouthernSun 來自: 114.40.177.252 (09/26 01:50)