【发布时间】:2012-11-20 20:56:16
【问题描述】:
只是为了一些背景,我正在使用带有模板 sparks 的 codeigniter。
所以在我的控制器中我有以下功能
public function information()
{
$this->load->library('session');
$developer_id = $this->session->userdata('developer_id');
$this->load->model("Developer_model");
$information = $this->Developer_model->get_developer($developer_id);
$this->template->set('information', (array) $information);
$this->template->build('dashboard/information');
}
在我看来,我是这样呼应的
<?php echo $information['email']; ?>
由于某种原因,我收到了“消息:未定义索引:电子邮件”
这是我的第一个问题,所以希望我不会不清楚,但基本上我是从我的数据库中获取 $information 并尝试回显电子邮件,这只是一系列项目中的一个。
当我 var_dump $information 时,我得到以下信息:
object(stdClass)#21 (2) { ["timestamp"]=> int(1353444880991) ["result"]=> object(stdClass)#22 (3) { ["email"]=> string(21) "anothertest@gmail.com" ["api_key"]=> string(64) "de0f57acfc018882841b3255e89da11cb238160e84a66fe5b45bda8c51137c72" } }
提前感谢您的帮助,在此之前我只使用 codeigniter 2 个月,除了一些非常小的 html 废话之外,我几乎没有进行任何编码。所以放轻松我 =D
【问题讨论】:
-
欢迎来到 StackOverflow。这是一个很好的第一个问题,谢谢发帖。
标签: php codeigniter