- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
<?php
class User
{
protected $_user_id;
protected $_user_email;
protected $_user_password;
public function __construct($user_id)
{
$user_record = self::_getUserRecord($user_id);
$this->_user_id = $user_record['id'];
$this->_user_email = $user_record['email'];
$this->_user_password = $user_record['password'];
}
public function __get($value) {}
public function __set($name, $value) {}
private static function _getUserRecord($user_id)
{
$user_record = array();
switch($user_id) {
case 1:
$user_record['id'] = 1;
$user_record['email'] = '[email protected]';
$user_record['password'] = 'i like croissants';
break;
case 2:
$user_record['id'] = 2;
$user_record['email'] = '[email protected]';
$user_record['password'] = 'me too!';
break;
case 'error':
throw new Exception('Ошибка библиотеки SQL!');
break;
}
return $user_record;
}
}
?>
Lure Of Chaos 19.03.2012 21:21 # 0
Lowezar 20.03.2012 09:17 # 0
Lure Of Chaos 20.03.2012 10:47 # 0
(похоже на орм ентити)
guest 20.03.2012 13:21 # 0
Lure Of Chaos 22.03.2012 01:51 # 0
guest8 09.04.2019 12:51 # −999