当我第一次加载我的应用程序时,我收到以下错误
A PHP Error was encountered
Severity: Notice
Message: Undefined index: user_full_name
Filename: templates/header.php
Line Number: 85
Backtrace:
File: /home/xyz/app/application/views/templates/header.php
Line: 85
Function: _error_handler
视野中的代码
<? if ($this->session->userdata['user_full_name'] == "" || $this->session->userdata['user_full_name'] == null): ?>
something something
控制器
public function __construct() {
parent::__construct();
$this->load->library('session');
$this->load->model('home_model');
$this->load->model('user_model');
}
为什么会这样。为什么我会收到一条错误,指出该变量无法识别
感谢 Krish
答案 0 :(得分:0)
如上面的Clive所述,我做了以下更改以纠正错误
更改此
<? if ($this->session->userdata['user_full_name'] == "" || $this->session->userdata['user_full_name'] == null): ?>
到
<? if (!isset($this->session->userdata['user_full_name'])): ?>