Correcting teacher:查无此人
Correction status:unqualified
Teacher's comments:11月29号课上,已经把这个作业讲解了。 你去看看,在把作业提交上来。如果不会,在来问我
class Db{
public $dsn;
public $user;
public $password;
public $pdo;
// 类里面的方法,不需要顺序。
public function __construct($dsn,$user,$password){
$this->dsn = $dsn;
$this->user = $user;
$this->password = $password;
$this->connect();
}
public function connect(){
$this->pdo = new PDO($this->dsn,$this->user,$this->password);
}
public function select($sql){
$arr = $this->pdo->prepare($sql);
return $arr;
}
}
$db = new Db('mysql:host=localhost;dbname=ou','root','root');
$sql = 'select * from user';
$user = $db->pdo->select($sql);
没有懂。第二节也无法看录播。白天还要上班,先交作业。请老师上课讲一下!