哪里有錯?
<?php //定義一個Car類并實例化一個對象 class?Car?{ ????public?$name?=?"布加迪威龍";???? ????public?$money?=?2000;???? ????public?function?getInfo()?{???????? ????????each?"它叫".$this->name."價值是:".$this->money; ?????} }$car?=?new?car();?>
<?php //定義一個Car類并實例化一個對象 class?Car?{ ????public?$name?=?"布加迪威龍";???? ????public?$money?=?2000;???? ????public?function?getInfo()?{???????? ????????each?"它叫".$this->name."價值是:".$this->money; ?????} }$car?=?new?car();?>
2020-08-22
舉報
2021-03-18
<?php
//定義一個Car類并實例化一個對象
class Car {
? ? public $name = "布加迪威龍";? ??
? ? public $money = 2000;? ??
? ? public function getInfo() {? ? ? ??
? ? ? ? echo "品牌名是:".$this->name."<br>價值是:".$this->money;
? ? ?}
}$car = new car();
$car->getInfo();
?>
2020-08-22
如何你實例化對象后,沒有去調用方法,給最后一行加個
$car->getInfo();
2020-08-22
你單詞拼錯了吧
應該是 echo?