📄 6-2.php3
字号:
<HTML>
<HEAD>
<TITLE>Figure 6-2</TITLE>
</HEAD>
<BODY>
<?
/* define class for tracking users */
class user
{
/*
** properties
*/
var $name;
var $password;
var $last_login;
/*
** methods
*/
// sets all the properties
function init($inputName, $inputPassword)
{
$this->name = $inputName;
$this->password = $inputPassword;
$this->last_login = time();
}
// get the date of the last login
function getLastLogin()
{
return(Date("M d Y", $this->last_login));
}
}
/*
** create an instance and then initialize
*/
$currentUser = new user;
$currentUser->init("Leon", "sdf123");
/*
** get the last login date
*/
print($currentUser->getLastLogin());
print("<BR>\n");
/*
** print the user's name
*/
print($currentUser->name);
print("<BR>\n");
?>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -