codeigniter、datamapper 和 ion_auth 错误让我很困惑

发布于 2024-11-08 13:38:54 字数 1161 浏览 0 评论 0原文

当我打电话时 -

$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 试图将身份验证模型加载到用户类?或者我在这里缺少什么?

when i call this-

$o = new Order();

codeigniter gives me this error-

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

At the minute the order model isnt doing anything other than whats in the _template from datamapper 1.8

here is the db schema for the order table

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 ;

This is what i was trying to do..

$o->user_id = $user->id;
            $o->status = 'new';
            $o->placed = unix_to_human(time(), TRUE, 'eu');;
            $o->will_send = 1;

any guidance on why CI is trying to load the auth model to the user class? or what am i missing here?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

猫腻 2024-11-15 13:38:54
  • Order 类在哪里?
  • 你如何将它包含到你的代码中?
  • Order 类是独立的吗?或集成到CodeIgniter?
  • 您检查/更改了 Ion_Auth 配置吗?
  • 您是否尝试过更改 Ion_Auth 中的代码?
  • 您是否尝试从 ion_auth 调用不存在的变量? (例如: $this->ion_auth->order;$this->ion_auth_model->order;
  • 您是否在以下位置调用了 CI 超类订单类?如果您尝试访问 CodeIgniter 的类和函数,则必须在 Order 类中获取 CI 实例。例如;

    类顺序
    {
        公共函数 __construct()
        {
            //调用 CI 超类来使用库、模型、助手、视图等...
            $this->ci =&获取实例();
    
            //使用CI的库:
            if ($this->ci->ion_auth->logged_in())
            {
                //在这里做事...
            }
        }
    }
    
  • Where is the Order class?
  • How do you include it to your code?
  • Does Order class standalone? or integrated to CodeIgniter?
  • Did you check/change your Ion_Auth config?
  • Did you ever tried to change the codes in Ion_Auth?
  • Did you try to call a variable from ion_auth that is not exists? (Eg: $this->ion_auth->order; or $this->ion_auth_model->order; )
  • Did you call CI superclass in Order class? If you trying to do access CodeIgniter's classes and functions, you have to get the CI instance inside Order class. Eg;

    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...
            }
        }
    }
    
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文