自动加载案例联系

Original 2019-05-16 16:36:08 194
abstract:<?php /**  * Created by PhpStorm.  * User: Administrator  * Date: 2019/5/14  * Time: 11:21  */ class Car {   &n
<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/5/14
 * Time: 11:21
 */

class Car
{
    public $brand;
    public $model;
    public $price;
    public function __construct($brand,$model,$price)
    {
        $this->brand=$brand;
        $this->model=$model;
        $this->price=$price;
    }
}
//$car=new Car('马自达','CX-4',200000);
<?php
//include 'pubic/Car.php';
spl_autoload_register(function ($className){
    include 'pubic/'.$className.'.php';
});
$car=new Car('马自达','CX-4',180000);
echo $car->brand.$car->model.':'.$car->price;


Correcting teacher:查无此人Correction time:2019-05-17 10:00:37
Teacher's summary:完成的不错,学习完类,就相当于php入门了。继续加油。

Release Notes

Popular Entries