当前位置: 首页>>代码示例>>PHP>>正文


PHP Car::setModel方法代码示例

本文整理汇总了PHP中Car::setModel方法的典型用法代码示例。如果您正苦于以下问题:PHP Car::setModel方法的具体用法?PHP Car::setModel怎么用?PHP Car::setModel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Car的用法示例。


在下文中一共展示了Car::setModel方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: array

    $cars = array($porsche, $ford, $lexus, $mercedes);
    $output = "";
    foreach ($cars as $car) {
        $output = $output . "<div class='row'>\n            <div class='col-md-6'>\n                <img src=" . $car->getPicture() . ">\n            </div>\n                <div class='col-md-6'>\n                    <p>" . $car->getModel() . "</p>\n                    <p>By " . $car->getPrice() . "</p>\n                    <p>\$" . $car->getMiles() . "</p>\n                </div>\n            </div>\n            ";
    }
    return $output;
});
$app->get("/car_search", function () {
    return "\n        <!DOCTYPE html>\n        <html>\n        <head>\n              <link rel='stylesheet' href='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css'>\n              <title>Find a Car</title>\n\n        </head>\n        <body>\n            <div class='container'>\n                <h1>Find a Car!</h1>\n                <form action='/view_results'>\n                    <div class='form-group'>\n                        <label for='price'>Enter Maximum Price:</label>\n                        <input id='price' name='price' class='form-control' type='number'>\n                        <label for='mileage'>Enter Maximum Miles:</label>\n                        <input id='mileage' name='mileage' class='form-control' type='number'>\n\n                    </div>\n                    <button type='submit' class='btn-success'>Submit</button>\n                </form>\n            </div>\n        </body>\n        </html>\n        ";
});
$app->get("/view_results", function () {
    $porsche = new Car("/pictures/porsche.jpg", "2014 Porsche 911", null, 7864);
    //$porsche->make_model = "2014 Porsche 911";
    //$porsche->price = 114991;
    //$porsche->miles = 7864;
    $porsche->setModel("Acura");
    $porsche->setMiles(10000);
    $ford = new Car("/pictures/ford.jpg", "2001 Ford F450", 55995, 14241);
    /*$ford->make_model = "2011 Ford F450";
      $ford->price = 55995;
      $ford->miles = 14241;*/
    $lexus = new Car("/pictures/lexus.jpg", "2013 Lexus RX 350", 44700, 20000);
    /*$lexus->make_model = "2013 Lexus RX 350";
      $lexus->price = 44700;
      $lexus->miles = 20000;*/
    $mercedes = new Car("/pictures/mercedes.jpg", "Mercedes Benz CLS550", 39900, 37979);
    /*$mercedes->make_model = "Mercedes Benz CLS550";
      $mercedes->price = 39900;
      $mercedes->miles = 37979;*/
    $cars = array($porsche, $ford, $lexus, $mercedes);
    $cars_matching_search = array();
开发者ID:julianstewart,项目名称:car_dealership_silex,代码行数:31,代码来源:app.php

示例2: shouldBeAbleToMerge

 /**
  * @test
  */
 public function shouldBeAbleToMerge()
 {
     // given
     $car = new Car();
     $car->deleteTableData()->yesImSure();
     $car->setBrand("Volkswagen");
     $car->setModel("Polo 1.6 TDI");
     $car->commit();
     $this->addCarProperty($car->getId(), "Hk", "75");
     $this->addCarProperty($car->getId(), "Mileage", "42000");
     $this->addCarProperty($car->getId(), "Year", "2010");
     $cars = new CarsWithProperties();
     // when
     $values = $cars->getValues();
     $firstCar = $values[0];
     // then
     $this->assertNotNull($firstCar['properties']);
 }
开发者ID:manishkhanchandani,项目名称:mkgxy,代码行数:21,代码来源:CollectionTest.php


注:本文中的Car::setModel方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。