Just give a brief indication:
Copy the code The code is as follows:
class test {
private $_name = '';
public function setName($name)
{
$this-> _name = $name;
return $this;
}
public function getName()
{
echo $this->_name . "n";
return $this;
}
}
$link = new test() ;
// Method chain
$link->setName('name1')->getName()->setName('name2')->getName()->setName('name3')-> ;getName();
Copy the code The code is as follows:
name1
name2
name3
The above introduces the office 2010 activation method. In fact, method chain can also be used in PHP, including the office 2010 activation method. I hope it will be helpful to friends who are interested in PHP tutorials.