【问题标题】:codeigniter ion auth forget passwordcodeigniter ion auth 忘记密码
【发布时间】:2013-06-10 14:52:33
【问题描述】:

我正在使用 codeigniter & ion auth。我在尝试向用户发送电子邮件时遇到问题。

这是有效的:

$message = 'hello';
$this->email->from($this->config->item('admin_email', 'ion_auth'), $this->config->item('site_title', 'ion_auth'));
$this->email->to($user->email);
$this->email->subject($this->config->item('site_title', 'ion_auth') . ' - ' . $this->lang->line('email_forgotten_password_subject'));
$this->email->message($message);

当我改为使用 tpl 时,它不起作用:
/views/forgot_password.tpl.php

$message = $this->load->view('forgot_password.tpl.php', $data, TRUE);
$this->email->from($this->config->item('admin_email', 'ion_auth'), $this->config->item('site_title', 'ion_auth'));
$this->email->to($user->email);
$this->email->subject($this->config->item('site_title', 'ion_auth') . ' - ' . $this->lang->line('email_forgotten_password_subject'));
$this->email->message($message);

请指教,谢谢。

【问题讨论】:

  • 您缺少视图文件的路径?默认为auth/email/forgot_password.tpl.php
  • 我的模板位于@ .../views/forgot_password.tpl.php
  • 你试过调试吗?在$this->load->view() 行之后添加echo $message; die();,看看它是否真的是在获取视图文件。如果这看起来不错,接下来您可能想尝试print_r($data);die(); 看看您是否传递了它需要的所有数据。
  • 服务器错误网站在检索localhost/demo/forgot_password/process 时遇到错误。它可能因维护而停机或配置不正确。
  • echo $message;die();@ 行中添加会出现该错误?

标签: codeigniter forgot-password ion-auth


【解决方案1】:

在您的代码中将“forgot_password.tpl.php”更改为“forgot_password.tpl”:

$message = $this->load->view('forgot_password.tpl.php', $data, TRUE);

$this->load->view() 中不需要 .php。

【讨论】:

    猜你喜欢
    • 2014-08-11
    • 2012-06-23
    • 1970-01-01
    • 2012-12-20
    • 2015-04-14
    • 1970-01-01
    • 2015-10-29
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多