使用 codeigniter 验证电子邮件

发布于 2024-09-12 20:01:55 字数 108 浏览 2 评论 0原文

如何使用 codeigniter 验证电子邮件地址?我刚刚翻了一遍说明书,没找到这个。

对于电子邮件验证,我的意思是与您在社区论坛上注册时看到的验证完全相同。

提前致谢!

How can I verify an email address with codeigniter? I just went through the manual, I couldn't find this.

With email verification, i mean the exact same verification you see when registering on a community forum.

Thanks in advance!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

轮廓§ 2024-09-19 20:01:55

使用电子邮件类发送电子邮件。该电子邮件可能包含带有“密钥”的链接,该链接是随机的、类似于散列的内容,例如 5dfg7898ssdf(我编了一个:))。该链接可能指向: example.com/verify/user/5dfg7898ssdf 然后在名为“verify”的 codeigniter 控制器中,放置此函数(只是一些快速代码):

function user($key = NULL)
{
 if($key)
 {
  // Find key in database
  // If it exists, then mark
  // the corresponding user as "activated"
 }
}

Use the Email Class to send the email. The email could contain a link with a "secret key", something random and hash-like, like 5dfg7898ssdf (I made that one up :) ). The link could point to: example.com/verify/user/5dfg7898ssdf Then in a codeigniter controller called "verify", you put this function (just some quick code):

function user($key = NULL)
{
 if($key)
 {
  // Find key in database
  // If it exists, then mark
  // the corresponding user as "activated"
 }
}
绳情 2024-09-19 20:01:55
function verify($verificationText=NULL){    

$noRecords = $this->HomeModel->verifyEmailAddress($verificationText);   

if ($noRecords > 0){ 
    $error = array( 'success' => "Email Verified Successfully!");   
}else{ 
    $error = array( 'error' => "Sorry Unable to Verify Your Email!");   
} 
    $data['errormsg'] = $error; 
    $this->load->view('index.php', $data);  
}
function verify($verificationText=NULL){    

$noRecords = $this->HomeModel->verifyEmailAddress($verificationText);   

if ($noRecords > 0){ 
    $error = array( 'success' => "Email Verified Successfully!");   
}else{ 
    $error = array( 'error' => "Sorry Unable to Verify Your Email!");   
} 
    $data['errormsg'] = $error; 
    $this->load->view('index.php', $data);  
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文