为什么会报错?
class Car {
public $speed = 0;
//增加speedUp方法,使speed加10
public static function speedUp(){
$this->speed+=10;
}
}
$car = new Car();
Car::speedUp();
echo $car->speed;
class Car {
public $speed = 0;
//增加speedUp方法,使speed加10
public static function speedUp(){
$this->speed+=10;
}
}
$car = new Car();
Car::speedUp();
echo $car->speed;
2017-11-25
举报