大神仙,老神仙,不大不小中神仙,給看看唄.為何繼承了就沒資料值了呢。我啥沒理解呢?

來源:互聯網
上載者:User
本帖最後由 bixuewei 於 2013-08-03 23:25:10 編輯

$val){define($name,$val);}$dsn = "mysql:host=".DB_HOST.";dbname=".DB_NAME;$dbo = new PDO($dsn,DB_USER,DB_PASS);/*$sql="select * from task";$stmt =$dbo->prepare($sql);$stmt ->execute();$results = $stmt -> fetchALL(PDO::FETCH_ASSOC);print_r($results); $stmt ->closeCursor();*/class DB_Connect{public $db;protected function __construct($dbo=NULL){$dsn = "mysql:host=".DB_HOST.";dbname=".DB_NAME;try{$this->db =new PDO($dsn,DB_USER,DB_PASS);}catch(Exception $e){die($e->getMessage());}}}class Task extends DB_Connect{public function __construct($dbo=NULL,$useData=NULL){parent::__construct($dbo);}private function _LoadEventTask ($id=NULL){$sql="SELECT * FROM `task`";try{$stmt = $this->db->prepare($sql);$stmt ->execute();$results = $stmt -> fetchALL(PDO::FETCH_ASSOC);$stmt ->closeCursor();return $results;}catch( Exception $e){die($e->getMessage() );}}}$ssss= new Task($dbo);var_dump ($ssss);


回複討論(解決方案)

大神們都睡了,又要失眠啦。

object(Task)#2 (1) {
["db"]=>
object(PDO)#3 (0) {
}
}

真勤勞的老神仙啊。

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.