php - Codeigniter return null array from user function -



php - Codeigniter return null array from user function -

i wrote user library:

class likeredis { public function __construct($data = array()){ homecoming $this->init(); } public function init(){ homecoming array('id' => 3); // total array } }

call function:

$comment = $this->load->library('likeredis', array());

output:

var_dump($comment); // null

why null array?

looks have casing problem, remember class names begin uppercase letter. seek this:

$comment = $this->load->library('likeredis', array());

additionally, think there may conceptual problem regarding objects. been few years since i've used codeigniter framework , i'm not sure loader using typically constructor of class not have homecoming value , instead returns instantiation of class default commonly referred object. access array should added fellow member of class if appropriate. perhaps help explain want utilize class for.

https://ellislab.com/codeigniter/user-guide/libraries/loader.html

based on above documentation looks want access object in manner more this:

$this->load->library('linkeredis', array()); $comment = $this->linkerdis->init(); var_dump($comment);

...and i'm still not totally convinced casing not beingness problem.

php codeigniter

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -