php - How do I call a model dynamically? (Codeigniter) -
i'm trying phone call model dynamically.
i cam across solution:
$fred = $type.'_model'; $this->load->model($fred); $this->$fred->get();
which works wondering how class variable i.e. simllar to:
$this->fred = $type.'_model';
but i'm not sure how utilize first example.. able help?
edit:
i've used i'm not sure if it's best solution?
$this->{$this->fred}->get();
php codeigniter oop activerecord
No comments:
Post a Comment