[php]代码库
<?
$password = "898"; //重设的密码
require_once("class_userChange.php");
$user = new UserChange("Jack"); //创建一个可以修改密码的user对象.
$username = $user->getUserName(); //分别调用方法取得数据
$userpsw = $user->getUserPSW();
$userage = $user->getUserAge();
$usergrade = $user->getUserGrade();
//这些和user类的一样,用起来很舒服。
echo "your name is ".$username."<br>"; //输出数据
echo "your password is ".$userpsw."<br>" ;
echo "your age is ".$userage."<br>" ;
echo "your grade is ".$usergrade."<br>" ;
//如果设置成功,显示新的密码。
if($user->setUserPSW($password)){
echo "you password be changed to ".$userpsw = $user->getUserPSW();
//这里,密码被重设了。
}
?>