返回自动加载案例联......登陆

自动加载案例联系

小孔2019-05-16 16:36:08199
<?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;


最新手记推荐

• 用composer安装thinkphp框架的步骤• 省市区接口说明• 用thinkphp,后台新增栏目• 管理员添加编辑删除• 管理员添加编辑删除

全部回复(0)我要回复

暂无评论~
  • 取消回复发送