class Person{public $a="96net.com.cn";public function eat(){echo ‘xxxx‘;}
}
1,NEW 关键词实例化对象
$xm= new Person();或者$xm= new Person;
2, 类名字符串,把类名赋值给变量
$strs=‘Person‘;
$xm= new $strs();
php7实例化类有对象有两种方法
原文:https://blog.51cto.com/13959155/2458699