<?php
class Car {
public $speed = 10;
//在这里使用重载实现speedDown方法
public function __call($name,$args){
if($name == "speedDown"){
$this->$speed -= 10;
}
}
}
$car = new Car();
$car->speedDown(); //调用不存在的speedDown方法
echo $car->speed;
没用!!!问题出在哪???
<?php
class Car {
public $speed = 10;
//在这里使用重载实现speedDown方法
public function __call($name,$args){
if($name == "speedDown"){
$this->$speed -= 10;
}
}
}
$car = new Car();
$car->speedDown(); //调用不存在的speedDown方法
echo $car->speed;
没用!!!问题出在哪???
2014-10-09
举报