当在对象后面添加()时候调用 __invoke
<?php
class Person
{
private $name;
private $age;
public function __construct($name,$age)
{
$this->name = $name;
$this->age = $age;
}
function __invoke($a,$b)
{
echo "{$a}{$b}";
}
}
$a = new Person("zs",10); $a("ss",1); //输出ss1
autoload 自动加载类文件,参数是类名
function __autoload($classname)
{
include "{$classname}".".php";
}