开发者

Get value from constructor to a function in php class

i have a class like:

class List_PendingVerify extends Rs_List {

 public function __construct( $id ) {
           }

    protected function loadData( ) {
           }
}

Now i how co开发者_JAVA百科uld i get value of $id in loadData function ?

so that i can be able to echo $id.

Thanks.


class List_PendingVerify extends Rs_List {
    public function __construct($id) {
        $this->id = $id;
    }

    protected function loadData() {
        echo $this->id;
    }
}

I recommend reading the Classes and Objects documentation. (In particular, the Properties section is relevant here.)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜