0
class User{
public $id, $username, $firstname, $lastname;
public function find(){
$result = blabla->query('SELECT * FROM users WHERE id = 1');
return $result;
}
}
我很感興趣的是如何將值(來自mysql)賦值給類變量。PHP OOP爲類變量賦值
$user = new User();
$user->find();
echo $user->username;
echo $user->lastname;