use*_*646 0 php switch-statement
这是代码:
<?php
$r=rand(1,7) //get a random number from 1 to 7 inclusive...
switch($r) { //...and get a random quote
case 1:
echo '<p class="quote">welcome to Moonside.<br/>Wecomel to Soonmide.<br/>Moonwel ot Cosidme.</p>';
break;
case 2:
echo '<p class="quote">Hey! Parking Meters! And you\'re walking around!<br/>Ha ha ha... That\'s so funny.</p>';
break;
case 3:
echo '<p class="quote">"Yes" is "No" and "No" is "Yes."<br/>It makes perfect sense in Moonside.</p>';
break;
case 4:
echo '<p class="quote">Hello!<br/>And... good-bye!</p>';
break;
case 5:
echo '<p class="quote">This is a headline from tonight\'s Moonside Press...<br/>\"Mani Mani is always Mani Mani at Mani Mani with all Mani Mani Mani."</p>';
break;
case 6:
echo '<p class="quote">I can sense...that...you have a controller...in your...hands...</p>';
break;
case 7:
echo '<p class="quote">Ness\'s HP drops to 0!<br/>Jeff\'s HP drops to 0!</p>';
break;
}
?>
Run Code Online (Sandbox Code Playgroud)
如果它可能很重要,我会提到整个PHP块在我的HTML源代码中缩进两次
| 归档时间: |
|
| 查看次数: |
8336 次 |
| 最近记录: |