摘要:class Mobile { public $brand; //品牌 public $model; //型号 public $price; //价格
class Mobile
{
public $brand; //品牌
public $model; //型号
public $price; //价格
public function __construct($brand, $model, $price)
{
$this->brand = $brand;
$this->model = $model;
$this->price = $price;
}
}
spl_autoload_register(function ($className) {
require __DIR__ . '/public/' . $className . '.php';
});
$mobile = new Mobile('vivo', 'nex S', 5800);
echo $mobile->brand . $mobile->model . ':' . $mobile->price, '<br>';
批改老师:查无此人批改时间:2019-04-19 09:20:59
老师总结:完成的不错。类自动加载,减少代码量,也增加运行速度。继续加油