时间:2021-07-01 10:21:17 帮助过:18人阅读
class ceshi {
public function aaa($a) {
$this->c = $a;
$r = $this->bbb();
echo $r;
}
public function bbb() {
$c = $this->c + 1;
return $c;
}
}
$xyz = new ceshi;
$xyz->aaa(5);
//使用类的属性
class ceshi {
private $c;
public function aaa($a) {
$this->c = $a;
echo $this->bbb();
}
public function bbb() {
return $this->c + 1;
}
}
$xyz = new ceshi;
$xyz->aaa(5);
class ceshi{
private $c;
public function aaa($a){
$this->c = $a;
$k = $this->bbb();
echo $k;
}
public function bbb(){
$this->c = $this->c + 1;
return $this->c;
}
}
$xyz = new ceshi;
$xyz->aaa(5);