在我的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