我正在研究我的项目,但现在我被困了:(
我正在关注PHP Academy OOP登录/注册视频,它帮助我完成我的项目,但在那里OOP视频系列没有电子邮件验证系统,所以我看到他们有另一个视频系列,涵盖电子邮件验证,但问题是。
我的代码正在成功发送电子邮件,但是当我看到电子邮件时,没有这样的密钥: -
致:** @ gmail.com
主题:激活您的帐户
来自:**** @ ****。com
你好超人,
您需要激活帐户
?http://localhost:8080/ **** /开发者/ activate.php电子邮件= ****** @ gmail.com&安培;键=
独特验证成功生成,并在我注册时自动保存在我的数据库中。
我的代码: -
if ($validate->passed()) {
$user = new User();
$salt = Hash::salt(32);
$email_coder = md5(Input::get('username') + microtime());
try {
$user->create(array(
'name' => Input::get('name'),
'username' => Input::get('username'),
'password' => Hash::make(Input::get('password'), $salt),
'salt' => $salt,
'email' => Input::get('email'),
'email_code' => $email_coder,
'joined' => date('Y-m-d H:i:s'),
'group' => 3
));
mail(Input::get('email'), 'Activate Your Account', "Hello
".Input::get('name').",\n\nYou need to activate your Account
\n\nhttp://localhost:8080/****/developers/activate.php?
email=".Input::get('email')."&key=".$user->email_code."\n\n-*****", "From : ****@****.com");
Session::flash('home', 'Welcome ' . Input::get('username') .
'! Your Confirmation link Has Been Sent To Your Email Address.');
Redirect::to('login.php');
} catch(Exception $e) {
echo $error, '<br>';
}
} else {
foreach ($validate->errors() as $error) {
echo "<script type='text/javascript'>alert('$error');</script>";
}
}
}
请帮助我微笑表情符号
此外,当我尝试运行print_r($ user)时出现错误
User Object ( [_db:User:private] => DB Object ( [_pdo:DB:private] =>
PDO Object ( ) [_query:DB:private] => PDOStatement Object ( [queryString] =>
INSERT INTO users (`name`, `username`, `password`, `salt`, `email`,
`email_code`, `joined`, `group`) VALUES (?, ?, ?, ?, ?, ?, ?, ?) )
[_error:DB:private] => [_results:DB:private] => Array ( ) [_count:DB:private]
=> 1 ) [_data:User:private] => [_sessionName:User:private] => user
[_cookieName:User:private] => hash [isLoggedIn:User:private] => )
Notice: Undefined property: User::$email_code in
C:\xampp\htdocs\****\developers\register.php on line 53