- class User
1 PHP[ | ]
PHP
Copy
<?php
class User {
private $id;
private $name;
private $password;
public function getId() {
return $id;
}
public function setId($id) {
$this->id = $id;
}
public function getName() {
return $name;
}
public function setName($name) {
$this->name = $name;
}
public function getPassword() {
return $password;
}
public function setPassword($password) {
$this->password = $password;
}
}
// 테스트
$user = new User();
$user->setId(123);
$user->setName('김하나');
print_r($user);
# User Object
# (
# [id:User:private] => 123
# [name:User:private] => 김하나
# [password:User:private] =>
# )
2 같이 보기[ | ]
편집자 Jmnote
로그인하시면 댓글을 쓸 수 있습니다.