<?php //include 'public/Car.php'; //include 'public/Mobile.php'; //自动加载器 spl_autoload_register(function($className){ require 'public/'.$className.'.php'; }); $car = new Car(); $mobile = new Mobile('苹果','ip8plus',6800); echo $car->brand.$car->model.$car->price,"<br>"; echo $mobile->brand.$mobile->model.$mobile->price,"<br>"; ?>