遇到 PHP 错误 严重性: 通知 消息: 未定义的属性: 视图配置文件::$Profile_模型


A PHP Error was encountered Severity: Notice Message: Undefined property: ViewProfile::$Profile_model

错误的图像

上图包含运行项目时发生的错误。

正如建议的那样,我尝试包含以下代码:

$autoload['libraries'] = array('database');

但它没有大喊任何结果,事实上它显示了另一个错误

遇到错误 您指定的数据库连接组无效。

,请给出一个解决方案。

应用建议的代码时发生的错误。

在控制器中添加构造函数,例如

class Landing extends CI_Controller {
    public function __construct()
    {
        parent::__construct();
        $this->load->library('session');
        $this->load->helper('form');
        $this->load->helper('url');
        $this->load->helper('html');
        $this->load->database();
    }
}

然后在我们的模型文件中尝试执行查询,例如

$this->db->select('*')->from('tablename');
$where = array('email' => $email);
$this->db->where($where);
$query = $this->db->get();
$resultId = $query->result_id;      
$row_count = $resultId->num_rows;

希望它能帮助你。