<?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);
?>
本文标题:php中的初始化方法 __construct
本文链接:https://www.haomeiwen.com/subject/brmsjktx.html
网友评论