<?php
class aClass{
public function a(){
echo "Yes";
return $this;
}
public function b(){
echo ",";
return $this;
}
public function c(){
echo "I agree with the word.";
}
}
$a = new aClass();
//调用方法
echo $a->a()->b()->c();
?>
关键:每个方法后面的return $this;