我称之为 -
$o = new Order();
codeigniter给了我这个错误 -
A PHP Error was encountered
Severity: Notice
Message: Undefined property: order::$ion_auth_model
Filename: libraries/Loader.php
Line Number: 1035
Fatal error: Call to a member function _assign_libraries() on a non-object in C:\xampplite\htdocs\portraits\system\libraries\Loader.php on line 1035
在那一刻,订单模型除了在datatepper 1.8中的_template中做了什么之外什么都不做
这是订单表的数据库架构
CREATE TABLE IF NOT EXISTS `orders` (
`order_id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`image_path` int(11) NOT NULL,
`status` enum('new','progress','completed','sent') NOT NULL,
`placed` date NOT NULL,
`updated_date` date NOT NULL,
`will_send` int(1) NOT NULL,
PRIMARY KEY (`order_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
这就是我想要做的事情。
$o->user_id = $user->id;
$o->status = 'new';
$o->placed = unix_to_human(time(), TRUE, 'eu');;
$o->will_send = 1;
有关CI为何尝试将auth模型加载到用户类的任何指导?或者我在这里缺少什么?
答案 0 :(得分:0)
$this->ion_auth->order;
或$this->ion_auth_model->order;
)您是否在Order类中调用了CI超类?如果您尝试访问CodeIgniter的类和函数,则必须在Order类中获取CI实例。例如;
Class Order
{
public function __construct()
{
//Calling CI superclass to use libraries, models, helpers, views etc...
$this->ci =& get_instance();
//using CI's libraries:
if ($this->ci->ion_auth->logged_in())
{
//Do stuff here...
}
}
}