在我的Flash文件,我有以下ActionScript代碼:未定義指數
gameEnd.submitBtn.removeEventListener(MouseEvent.MOUSE_DOWN, submitScore);
的submitScore
功能如下:
public function submitScore(e:MouseEvent):void
{
this.addChild(scoreAdded);
scoreAdded.x = 165;
scoreAdded.y = 85;
var url:URLRequest = new URLRequest("./submitscore.php");
var thevariables:URLVariables = new URLVariables();
url.method = "GET";
thevariables.score = scoreText.text;
url.data = thevariables;
navigateToURL(url,"_self");
}
在我submitscore.php
文件我有:
<?php
$scorefromflash = $_GET['score'];
echo ("Score: ".$scorefromflash);
?>
但是,這會導致錯誤Notice: Undefined index: score in submitscore.php
。任何人都知道爲什麼這不起作用?我用完全相同的方式完成了名稱和分數,但是使用了不同的變量名稱,分數從不起作用。
我真的很感謝任何幫助,因爲我今天真的需要解決這個問題。
凡在submitscore功能的 '得分' 變量?如果沒有定義,那麼這就是爲什麼你有一個未定義的索引。 – H2ONOCK
意外地將錯誤的代碼行復制到問題中。更新它的實際內容。 – Liam
[PHP:「Notice:Undefined variable」和「Notice:Undefined index」]的可能重複(http://stackoverflow.com/questions/4261133/php-notice-undefined-variable-and-notice-undefined-index) – Jocelyn