以下是一个简单的PHP类实例,它展示了如何定义一个类、创建对象以及如何使用这个对象。
类定义
```php

class Car {
// 属性
public $brand;
public $model;
public $year;
// 构造函数
public function __construct($brand, $model, $year) {
$this->brand = $brand;
$this->model = $model;
$this->year = $year;
}
// 方法
public function displayInfo() {
echo "







