发布网友 发布时间:2022-04-25 15:53
共2个回答
热心网友 时间:2023-10-14 22:32
语法错误 找index.php文件第77行 有没有声明的变量出现热心网友 时间:2023-10-14 22:33
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">追问$c1 = new car("benz","2.5","red");上面三个数据怎么输出呢
追答class car{
private $color;
private $weight;
private $logo;
function _construct($logo,$weight=2.0,$color="white"){
$this->color=$color;
$this->weight=$weight;
$this->logo=$logo;
}
function run(){
echo"i am running!";
}
function beep(){
echo"di~di~...";
}
function info(){
echo "我是".$this->logo."牌汽车,我的颜色是".$this->color.",我的重量是".$this->weight."吨";
}
function __destruct(){
echo"对象已被消亡!";
}
}
$c1 = new car("benz","2.5","red");
$c1->run();
$c1->beep();
$c1->info();