我得到未定义的变量,我不确定如何将其声明为变量?
Notice: Undefined variable: [$scores_round0],
[$scores_round1],
[$scores_round2],
[$scores_final]
谢谢
这是我正在使用的功能:-
public function bracketScores($tournID) {
$maxRounds = $this -> maxRounds($tournID);
$scores_template = false;
for($i = 0; $i < $maxRounds - 1; $i++) {
$scores_template.='[$scores_round'.$i.'],<br>';
}
$scores_template.='[$scores_final]';
return $scores_template;
}
从类文件:
$scores_template = $_brackets -> bracketScores($tournID);
并从模板文件中:
<script type="text/javascript">var autoCompleteData =
{
teams : [
{$brackets}
],
results :
[
[
{$$scores_template}
]
]
}
</script>
<div id="brackets"><div id="autoComplete"></div></div>