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‘!但是它并没有像它应该发生的那样发生?逻辑是正确的,没有显示错误。
发布于 2014-04-22 20:04:09
您需要使用session_start()方法启动会话。
https://stackoverflow.com/questions/23218863
复制相似问题