过去1小时我正在研究这个问题,我无法让它工作...... 所以,我改变了我的代码,看看他输出了什么,这里代码改变了:
<?php
include('../assets/class/usercount.class.php');
include('../assets/class/count.class.php');
include('../assets/class/user.class.php');
include('../assets/class/userupdate.class.php');
$select = $_POST['pick'];
if ($select == 'heads') {
$select = '1';
} elseif ($select == 'tails') {
$select = '2';
}
$amount = $_POST['amount'];
$balancee = $_SESSION['balance'];
$amountt = $amount - '1';
echo $_POST['pick'] . '<br />' . $select . '<br />' . $amount . '<br >' . $balancee;
?>
作为输出我得到:
负责人1 100 773
这很好,但当我在其上完成整个脚本时:
<?php
include('../assets/class/usercount.class.php');
include('../assets/class/count.class.php');
include('../assets/class/user.class.php');
include('../assets/class/userupdate.class.php');
$select = $_POST['pick'];
if ($select == 'heads') {
$select = '1';
} elseif ($select == 'tails') {
$select = '2';
}
$amount = $_POST['amount'];
$balancee = $_SESSION['balance'];
$amountt = $amount - '1';
if (is_nummeric($amountt)) {
if ($balancee > $amountt) {
$amount = $amountt + '1';
$num = rand(1, 2);
if ($num == $select) {
$amountt = $amount * '2';
$balance = $balancee + $amountt;
update($_SESSION['id'], 'balance', $balance);
aaron('won', 'up', $amountt);
header("Location: coinflip.php?message=You have won $amount R$! Your balance is now $balance R$!");
die();
} elseif ($num != $select) {
$balance = $balancee - $amount;
update($_SESSION['id'], 'balance', $balance);
header("Location: coinflip.php?message=You have lost $amount R$. Your balance is now $balance R$");
die();
} else {
header("Location: coinflip.php?message=Your input is wrong!");
die();
}
} else {
$amount = $amount + 1;
header("Location: coinflip.php?message=Not enough balance! you need $amount R$, you have $balance R$!");
die();
}
} else {
header("Location: coinflip.php?message=Your input is wrong!");
die();
}
?>
然后我收到HTTP错误500,请帮帮我!我正在研究这个问题好几个小时但仍然无效。我找不到解决办法:(
答案 0 :(得分:1)
在这种情况下,您应该查看apache错误日志。 Apache日志:“PHP致命错误:在第2行的C:\ wamp \ www \ index.php中调用未定义的函数is_nummeric()”
Is_nummeric()不正确,正确“is_numeric()”:)