<?php
class db {
private $db;
const CONS=constroctor start;
const OVER=Class now over;
public function __construct() {
$this>db=mysql;
$this>show(self::CONS);
}
public function getDriver() {
$this>show($this>db);
}
private function show($param) {
echo $param
;
}
public function __destruct() {
$this>show(self::OVER);
}
}
<?php
require dbphp;
$db=new db();
$db>getDriver();
/*
will echo:
constroctor start
mysql
Class now over
*/ 待续