繁体   English   中英

Codeigniter,Datamapper和ion_auth错误让我感到困惑

[英]codeigniter, datamapper and ion_auth error is leaving me confused

当我打电话给这个

$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

目前,订单模型除了执行datamapper 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模型加载到用户类的任何指导? 还是我在这里想念什么?

  • 订单类在哪里?
  • 您如何将其包含在代码中?
  • Order类是否独立? 或集成到CodeIgniter?
  • 您是否检查/更改了Ion_Auth配置?
  • 您是否曾经尝试更改Ion_Auth中的代码?
  • 您是否尝试从ion_auth调用不存在的变量? (例如: $this->ion_auth->order;$this->ion_auth_model->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... } } } 

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM