php构造函数求大神指教!
程序员文章站
2024-01-25 16:34:28
...
php函数
class Person{
private $name;
private $age;
private $gender;
public function __construct($name,$age,$gender){ $this->setName($name); $this->setAge($age); $this->setGender($gender);}public function setName($name){ $this->name = $name;}
}
// ... getter setter 方法
}
$peron = new Person("lee",18,'男');
?>
为什么报错呢 ?
上一篇: AJAX简介