Switch语句用于根据不同条件执行不同的动作
<?php
$text="red";
switch ($text){
case "red";
each "你喜欢红色";
break;
case "green";
each "你喜欢绿色";
break;
case "black";
each "你喜欢黑色";
break;
case "yellow";
each "你喜欢黄色";
break;
default;
each "你喜欢的不是红,绿,黑、或黄色"
}
?>
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号