doctrine/instantiator

# sudo composer require doctrine/instantiator
<?php
require 'vendor/autoload.php';

require_once 'hello.php'; // 如果不存在,将报错

// class hello {
//     public function sayHello() {
//         echo "hello php";
//     }
// }

$instantiator = new \Doctrine\Instantiator\Instantiator();
$instance = $instantiator->instantiate('hello');
$instance->sayHello();
posted @ 2020-06-15 21:01  TBHacker  阅读(253)  评论(0编辑  收藏  举报