标签:span function turn ret color 操作 return 返回 get
连贯操作的重点是返回当前对象,以便可以继续执行
class Ceshi{ public $str = ‘‘; public function f1($a){ $this->str .= $a; //连贯操作的重点是返回当前对象,以便可以继续执行 return $this; } public function f2($b){ $this->str .= $b; return $this; } public function get(){ return $this->str; } } $MyClass = new Ceshi(); echo $MyClass->f1(1)->f2(2)->get();
标签:span function turn ret color 操作 return 返回 get
原文地址:http://www.cnblogs.com/phpyangbo/p/5989008.html