。。。。。。。。。来一个简单的,基础的问题。。。。。。。。。。。 $this->data = $this->dbh->getRow($query, array($user),DB_FETCHMODE_ASSOC); $this->dbh->getRow第一个 -> 是调用属性 dbh但是第二个 -> 会什么怎么回事呢。。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 精心研读下面代码将有助于你理解什么是属性重载。<?php //装入PEAR的 <a href="http://pear.php.net/package/DB/">DB package</a> //远程引用 require_once "DB.php"; //特殊调用。 class Persistable { //类持续 贮存。类。。 private $data = array(); private $table = "users"; public function __construct($user) //。方法 1 __construct{ $this->dbh = DB::Connect("mysql://user:password@localhost/database");// 属性 dbh,返回 resource . $query = "SELECT id, name, email, country FROM " .$this->table . " WHERE name = ?";//id,name,email,country //-----table users-----name = ?$this->data = $this->dbh->getRow($query, array($user),DB_FETCHMODE_ASSOC); //属性 data getRow } public function __get($member) { //。方法 2 __get if (isset($this->data[$member])) { return $this->data[$member]; } } public function __set($member, $value) { //。。方法3 __set // dataset的ID是只读的 if ($member == "id") { return; } if (isset($this->data[$member])) { $this->data[$member] = $value; } } public function __destruct() { //。。方法 4 __destruct $query = "UPDATE " . $this->table . " SET name = ?, email = ?, country = ? WHERE id = ?"; $this->dbh->query($query, $this->name, $this->email, $this->country, $this->id); } } $class = new Persistable("Martin Jansen"); //建立对象。。 $class->name = "John Doe";// $class->country = "United States"; $class->email = "[email protected]";?> 使用ffmpeg视频转换为flv 文件变小了 急求php代码 求高手指点!!! php 验证问题 PHP URL传递中文出现乱码 谁能告诉我会员模块的运做原理 正在做个网站,遇到了点麻烦,本人对php不是很了解,希望大家给点帮助 liunx 下apache.conf配置 匹配字母,数字,空格,以及! " # $ % & ' ( ) = ~ | - ^ \ @ [ ; : ] , . / ` { + * } < > ? _的正则表达式 关于静态页面的问题 adodb的session是怎么干活的? 关于PHP交易系统 新工具来了,呵呵
精心研读下面代码将有助于你理解什么是属性重载。<?php
//装入PEAR的 <a href="http://pear.php.net/package/DB/">DB package</a> //远程引用
require_once "DB.php"; //特殊调用。
class Persistable { //类持续 贮存。类。。
private $data = array();
private $table = "users";
public function __construct($user) //。方法 1 __construct{ $this->dbh = DB::Connect("mysql://user:password@localhost/database");// 属性 dbh,返回 resource .
$query = "SELECT id, name, email, country FROM " .$this->table . " WHERE name = ?";//id,name,email,country //-----table users-----name = ?$this->data = $this->dbh->getRow($query, array($user),DB_FETCHMODE_ASSOC); //属性 data getRow
}
public function __get($member) { //。方法 2 __get
if (isset($this->data[$member])) {
return $this->data[$member];
}
}
public function __set($member, $value) { //。。方法3 __set
// dataset的ID是只读的
if ($member == "id") {
return;
}
if (isset($this->data[$member])) {
$this->data[$member] = $value;
}
}
public function __destruct() { //。。方法 4 __destruct
$query = "UPDATE " . $this->table . " SET name = ?,
email = ?, country = ? WHERE id = ?";
$this->dbh->query($query, $this->name, $this->email,
$this->country, $this->id);
}
}
$class = new Persistable("Martin Jansen"); //建立对象。。
$class->name = "John Doe";//
$class->country = "United States";
$class->email = "[email protected]";
?>