& get_instance() |
good morning riends...
I'm not going to work with CI Hook. I'm trying to import "= & get_instance ()" but to no avail. I'm using version 3.1.6. What can it be? <?php class Login { public $CI; public function __construct() { // Assign the CodeIgniter super-object $this->CI =& get_instance(); } function validar() { echo "validar"; $this->CI->load->helper('url'); } error: A PHP Error was encountered Severity: Notice Message: Trying to get property of non-object Filename: hooks/Login.php Line Number: 16 Backtrace: File: C:\xampp4\htdocs\crm-radiomar\application\hooks\Login.php Line: 16 Function: _error_handler File: C:\xampp4\htdocs\crm-radiomar\index.php Line: 315 Function: require_once Fatal error: Call to a member function helper() on null in C:\xampp4\htdocs\crm-radiomar\application\hooks\Login.php on line 16 A PHP Error was encountered Severity: Error Message: Call to a member function helper() on null Filename: hooks/Login.php Line Number: 16 Backtrace: Thanks! Tiago Cosme
If your not going to use hooks then why is your Login.php Library in the hooks folder?
Also it depends on whats been loaded see Codeigniter.php and Loader.php in the ./system folder. What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
(10-04-2017, 02:00 AM)InsiteFX Wrote: If your not going to use hooks then why is your Login.php Library in the hooks folder? You can put your class in the Models directory or a subdirectory of Models. You will need to include it in your controller or in whichever model class is using the Login class. Code: defined('BASEPATH') OR exit('No direct script access allowed'); |
Welcome Guest, Not a member yet? Register Sign In |