예제 #1
0
      </div>
    </body>';
});
$app->get('/parcel', function () {
    $first_parcel = new Parcel($_GET["length"], $_GET["width"], $_GET["height"], $_GET["weight"]);
    $first_parcel->setLength($_GET["length"]);
    $first_parcel->setWidth($_GET["width"]);
    $first_parcel->setHeight($_GET["height"]);
    ?>
      <title>Answers</title>

      <h1> Here are the answers below: </h1>

<?php 
    $first_parcel_length = $first_parcel->getLength();
    if ($first_parcel->getlength() == 0) {
        echo "<p>Length: A number please!</p>";
    } else {
        echo "<p>Length: {$first_parcel_length} (ft)</p>";
    }
    $first_parcel_width = $first_parcel->getWidth();
    if ($first_parcel->getWidth() == 0) {
        echo "<p>Width: A number please!</p>";
    } else {
        echo "<p>Width: {$first_parcel_width} (ft)</p>";
    }
    $first_parcel_height = $first_parcel->getHeight();
    if ($first_parcel->getHeight() == 0) {
        echo "<p>Height: A number please!</p>";
    } else {
        echo "<p>Height: {$first_parcel_height} (ft)</p>";