Heim > Artikel > Backend-Entwicklung > 求帮忙?php oop事例
求帮忙?php oop例子
class animal{
public $name="";
public $color="";
public $age="";
function getInfo(){return $this->name;}
function setInfo($name){return $this->name;}//编译器提示警告
}
$pig=new animal();
$pig->setInfo('猪');
$name=$pig->getInfo();//编译器提示错误
echo $name;
?>