codeigniter core / model.php未定义的属性 [英] codeigniter core/model.php undefined property

查看:53
本文介绍了codeigniter core / model.php未定义的属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从未接触过model.php文件,但是却遇到此错误。 Jobprocess是我的控制器, $ lastname 是在其中正确分配的变量。我不知道为什么会出现此错误。这是使用codeigniter框架

I have never touched the model.php file, however I am getting this error. Jobprocess is my controller and $lastname is a variable assigned correctly within it. I have no idea why this error is coming up. This is using codeigniter framework

Message: Undefined property: Jobprocess::$lastname

Filename: core/Model.php

Line Number: 50


推荐答案

确保在第56行的 application / config / autoload.php 上自动加载模型。

Make sure to autoload model on application/config/autoload.php at line 56.

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

第二,确保php文件的名称是小写(mymodel.php)
最后,请确保将模型类名称的首字母大写

Second, make sure that the name of php file is lowercase (mymodel.php) and finally, make sure to capitalize the first letter of your model class name

class Mymodel extends CI_Model{}

* Codeigniter版本3 -模型的文件名必须以大写字母开头:
Model_name是您的类的名称。类名的首字母必须大写,其余名称均小写。确保您的类扩展了基础Model类。 https://www.codeigniter.com/userguide3/general/models.html

*Codeigniter Version 3 - Models must have a file name that begins with a capital letter: "Where Model_name is the name of your class. Class names must have the first letter capitalized with the rest of the name lowercase. Make sure your class extends the base Model class." https://www.codeigniter.com/userguide3/general/models.html

这篇关于codeigniter core / model.php未定义的属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆