Php codeigniter中的未定义索引错误
只是为了一些背景,我使用了带有sparks模板的codeigniter 因此,在我的控制器中,我有以下功能Php codeigniter中的未定义索引错误,php,codeigniter,Php,Codeigniter,只是为了一些背景,我使用了带有sparks模板的codeigniter 因此,在我的控制器中,我有以下功能 public function information() { $this->load->library('session'); $developer_id = $this->session->userdata('developer_id'); $this->load->model("Developer_model"); $informatio
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']; ?>
提前感谢您的帮助,在此之前,我只使用codeigniter工作了2个月,除了一些非常小的html废话之外,我几乎没有进行任何编码。因此,请对我放松一下=D如果您查看您的vardump,您的信息类中还有第二类“结果”。尝试
$information[“result”][“email”] 在模型返回响应->结果中;而不是回应。然后你可以使用$信息[“电子邮件”]。。。应该可以工作了欢迎来到StackOverflow。这是一个很好的第一个问题,谢谢你的发帖。
object(stdClass)#21 (2) { ["timestamp"]=> int(1353444880991) ["result"]=> object(stdClass)#22 (3) { ["email"]=> string(21) "anothertest@gmail.com" ["api_key"]=> string(64) "de0f57acfc018882841b3255e89da11cb238160e84a66fe5b45bda8c51137c72" } }