php中的初始化方法 __construct
2020-08-21 本文已影响0人
zlchen
<?php
class Test
{
public function __construct($sex,$age){ #初始化方法
$this->sex = $sex;
$this->age = $age;
}
}
$test = new Test('nan',26);
?>
<?php
class Test
{
public function __construct($sex,$age){ #初始化方法
$this->sex = $sex;
$this->age = $age;
}
}
$test = new Test('nan',26);
?>