欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

PHP實(shí)現(xiàn)鏈?zhǔn)讲僮鞯脑碓斀?/h1>
 更新時間:2016年09月16日 12:54:06   投稿:jingxian  
下面小編就為大家?guī)硪黄狿HP實(shí)現(xiàn)鏈?zhǔn)讲僮鞯脑碓斀?。小編覺得挺不錯的,現(xiàn)在就分享給大家,也給大家做個參考。一起跟隨小編過來看看吧

在一個類中有多個方法,當(dāng)你實(shí)例化這個類,并調(diào)用方法時只能一個一個調(diào)用,類似:

db.php

<?php

class db
{
public function where()
{
//code here
}
public function order()
{
//code here
}
public function limit()
{
//code here
}
} 

index.php

<?php

$db = new db();

$db->where();
$db->order();
$db->limit(); 

如果要實(shí)現(xiàn)鏈?zhǔn)秸{(diào)用,這要在方法的結(jié)束添加return $this即可。

db.php

<?php

class db
{
public function where()
{
//code here
return $this;
}
public function order()
{
//code here
return $this;
}
public function limit()
{
//code here
return $this;
}
} 

index.php

<?php

$db = new db();

$db->where()->order()->limit();

以上這篇PHP實(shí)現(xiàn)鏈?zhǔn)讲僮鞯脑碓斀饩褪切【幏窒斫o大家的全部內(nèi)容了,希望能給大家一個參考,也希望大家多多支持腳本之家。

相關(guān)文章

最新評論