Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
基本上就是标题所说的。
代码:
$score = 0; $totalScore = 0; $totalScore+=1; if(@$_POST['Q1'] == 'Reggae') { echo ""; $score += 1; }
这基本上是 1 个问题答案的示例,因为您可以看到如果您做对了,您将获得 1 分。但是由于有 30 个问题,但一次只显示 10 个问题,所以$totalScore仍然设置为 30。我怎样才能使等式从 10 中取出?请 :)
$totalScore
将变量的初始值更改为$totalScore = 10;并删除所有$totalScore+=1;
$totalScore = 10;
$totalScore+=1;