PHP $this variable

前端 未结 6 1258
日久生厌
日久生厌 2020-12-29 22:28

I am reading some PHP code that I could not understand:

class foo {
  function select($p1, $dbh=null) {
    if ( is_null($dbh) )
        $dbh = $this->dbh         


        
6条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-29 22:37

    class foo {
      function select($p1, $dbh=null) {
        if ( is_null($dbh) )
            $this->dbh = $dbh ; 
        return; 
      }
    
      function get() {
        return $this->dbh; 
      }
    }
    

提交回复
热议问题