function pokemon2()
{
include 'details.php';
$damage = $_POST['attack'];
$oppo_health = $_SESSION['oppo_health'];
if($oppo_health < 0)
{
echo "Died!";
}
else
{
$oppo_path = $_SESSION['path'];
echo "<br />";
echo $oppo_path;
echo "<br />";
$oppo_health = $oppo_health - $damage;
echo $oppo_health;
$_SESSION['attack'] = $damage;
$_SESSION['oppo_health'] = $oppo_health;
}
}
如果$oppo_health
低于0,代码应显示'Died'!
但它没有发生,因为它应该??逻辑是正确的,没有显示错误。
答案 0 :(得分:0)
您需要使用session_start()方法启动会话。