本文整理汇总了PHP中Car::setImage方法的典型用法代码示例。如果您正苦于以下问题:PHP Car::setImage方法的具体用法?PHP Car::setImage怎么用?PHP Car::setImage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Car
的用法示例。
在下文中一共展示了Car::setImage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Car
$porsche->setImage("images/porsche.jpg");
$ford = new Car();
$ford->setMake_Model("2014 Ford f450");
$ford->setPrice(56892);
$ford->setMiles(12465);
$ford->setImage("images/ford.jpg");
$lexus = new Car();
$lexus->setMake_Model("2013 Lexus RX 350");
$lexus->setPrice(44700);
$lexus->setMiles(20000);
$lexus->setImage("images/lexus.jpg");
$mercedes = new Car();
$mercedes->setMake_Model("Mercedes Benz CLS550");
$mercedes->setPrice(39900);
$mercedes->setMiles(37979);
$mercedes->setImage("images/mercedes.jpg");
$cars = array($porsche, $ford, $lexus, $mercedes);
$cars_matching_search = array();
foreach ($cars as $car) {
if ($car->worthBuying($_GET["price"]) && $car->maxMileage($_GET["mileage"])) {
array_push($cars_matching_search, $car);
}
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Car Dealership</title>
</head>
示例2: getImage
}
function getImage()
{
return $this->image;
}
}
$porsche = new Car("2014 Porsche 911", "images/911.jpeg", 7864, 114991);
$ford = new Car("2011 Ford F450", "images/ford.jpg", 14241);
$lexus = new Car("2013 Lexus RX 350", "images/lexus.jpg", 20000);
$mercedes = new Car("Mercedes Benz CLS550", "images/mercedes.jpg", 37979, 39900);
$porsche->setName("2013 Porsche 911");
$porsche->setMileage(55555);
$lexus->setPrice(0);
$porsche->setName("2012 Porsche 911");
$mercedes->setName("2009 Mercedes Benz CLS550");
$ford->setImage("images/pinto.jpeg");
$cars = array($porsche, $ford, $lexus, $mercedes);
$cars_matching_search = array();
foreach ($cars as $car) {
if ($car->getPrice() <= $_GET["price"] && $car->getMiles() <= $_GET["mileage"]) {
array_push($cars_matching_search, $car);
}
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Your Car Dealership's Homepage</title>
<link rel="stylesheet" href="styles.css" media="screen" title="no title" charset="utf-8">
</head>