时间:2021-07-01 10:21:17 帮助过:20人阅读
a()->b()->c();
function a() {
$r = new obj1;
return $r;
}
class obj1{
public function b(){
$r=new obj2;return $r
}
}
class obj2{
public function c(){
//do something
}
}
class T {
function b($v) {
echo $v;
return $this;
}
function c($v) {
echo $v;
return $this;
}
}
function a($v) {
echo $v;
return new T;
}
a('aa')->b('bb')->c('cc');