语法错误,意外'$ type'(T_VARIABLE),期待'('[重复]
问题描述:
This question already has an answer here:
if($_POST) {
$type = $_POST['roll'];
if $type == 1 {
$number = rand(1,100)
if $number <= 50 {
echo "Winner!"
}
else {
echo "Loser!"
}
}
};
Can't figure out what is wrong. I am kinda new to PHP also. Type (or roll) is always 1 (for now)
</div>
答
I think you just need to put
if ($type == 1) {
instead of your actual statement, the condition of the if need that. And so you'll need it too on the second "if"
Watch what your error is showing, it's exactly what you need.