PHP语句 October 24, 2020 966 PHP条件语句if语句1234567<?php $t=date("H");if ($t<"20"){ echo "Have a nice day!";}?> if…else 语句123456789101112<?php $t=date("H");if ($t<"20"){ echo "Have a good day!";}else{ echo "Have a good night!";}?> if…elseif…else 语句12345678910111213141516<?php $t=date("H");if ($t<"10"){ echo "Have a good morning!";}elseif ($t<"20"){ echo "Have a good day!";}else{ echo "Have a good night!";}?> PHP Switch语句1234567891011121314151617181920212223<?php $favcolor="red";switch ($favcolor){case "red": echo "你喜欢的颜色是红色!"; break;case "blue": echo "你喜欢的颜色是蓝色!"; break;case "green": echo "你喜欢的颜色是绿色!"; break;default: echo "你喜欢的颜色不是这三个!";}?> #输出结果:#你喜欢的颜色是红色! 本文作者:Almond 本文链接:http://example.com/2020/10/24/php%E8%AF%AD%E5%8F%A5/index.html 版权声明:本博客所有文章均采用 BY-NC-SA 许可协议,转载请注明出处! PHP php数组 python_爬虫基础