簡體   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