您好,登錄后才能下訂單哦!
var test = function (){
this.str = '',
this.a = function (){
this.str += "a"
return this
},
this.b = function(){
this.str += "b"
return this
}
this.out = function(){
console.log(this.str)
}
}
var entity = new test()
entity.a().b().out()
ab
<?php
class single{
public $out;
public function a($a){
$this->out .= $a;
return $this;
}
public function b($b){
$this->out .= $b;
return $this;
}
public function say(){
echo $this->out.PHP_EOL;
}
public function get(){
return $this->out;
}
}
$single = new single();
$out = $single->a('a')->b('b')->say();
$get = $single->a('a')->b('b')->get();
echo $get;
ab
abab
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。