CI3框架初识-控制其使用注意-Call to a member function model() on null in
入手ci3 在使用model处理数据的时候发现各种报错,结果是控制器中的构造方法需要加载父类构造方法
报错提示如下 : Fatal error: Call to a member function model() on null in
报错例子如下:
A PHP Error was encountered
Severity: Notice
Message: Undefined property: Blog::$load
Filename: controllers/Blog.php
Line Number: 16
Backtrace:
File: D:UPUPW_AP5.6htdocsci3applicationcontrollersBlog.php
Line: 16
Function: _error_handler
File: D:UPUPW_AP5.6htdocsci3index.php
Line: 316
Function: require_once
( ! ) Fatal error: Call to a member function model() on null in D:UPUPW_AP5.6htdocsci3applicationcontrollersBlog.php on line 16
Call Stack
# Time
Memory FunctionLocation
1 0.0002
145256 {main}( )...index.php:0
2 0.0026
147632 require_once( "D:UPUPW_AP5.6htdocsci3systemcoreCodeIgniter.php" )...index.php:316
3 0.0363
318920 Blog->__construct( )...CodeIgniter.php:518
A PHP Error was encountered
Severity: Error
Message: Call to a member function model() on null
Filename: controllers/Blog.php
Line Number: 16
Backtrace: