显示游戏处于购买或尝试模式的 PHP 条件?
phpserver side programmingprogramming
对于此类条件评估,使用 PHP if()、else if() 和 else。
示例
PHP 代码如下
<!DOCTYPE html> <html> <body> <?php $gameMode="BUY"; if($gameMode=="TRY") echo "GAME IS IN ",$gameMode," MODE","<br>"; else if($gameMode=="BUY") echo "GAME IS IN ",$gameMode," MODE","<br>"; else echo "GAME IS NEITHER TRY NOR BUY MODE","<br>"; ?> </body> </html>
输出
GAME IS IN BUY MODE