php初始化方法:使用構(gòu)造法construct實(shí)現(xiàn),代碼為【public function __construct($count,$money){$this->count = $count;$this->money = $money;}】。
php初始化方法:
使用構(gòu)造法construct實(shí)現(xiàn)
<?php class Saler{ public function __construct($count,$money){ #初始化方法 $this->count = $count; $this->money = $money; } } $s1 = new Saler(100,100); $s2 = new Saler(1000,1000); $s1->__construct(1000,1000); var_dump($s1,$s2);
想了解