语法错误,PHP中出现意外的T_开关

语法错误,PHP中出现意外的T_开关,php,switch-statement,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.

代码如下:

<?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;
    }
    ?>


如果这有什么关系的话,我会提到整个PHP块在我的HTML源代码中缩进了两次。

你之前忘记了一个分号。

哈哈,愚蠢的错误,但是也要这样做