<?php class Cat{ public $name; public $age; public $color; } //创建一个对象 $cat1=new Cat(); $cat1->name="小白"; //给对象成员赋值 $cat1->age=3; $cat1->color="白色"; echo $cat1->name."||".$cat1->age."||".$cat1->color; ?>