-2
現在我有這個在我的代碼:
$this->data['products'] = $this->$mdl->get_objs_by_category($cat);
,但我希望能夠做一些喜歡更容易維護:
$objs = 'products';
$this->data[$objs] = $this->$mdl->get_objs_by_category($cat);
但$this->data[$objs]
似乎並沒有被工作。這甚至可能在PHP中。如果是,它的正確接線是什麼?
這應該工作。 – hek2mgl
不應該這樣工作嗎?你有沒有嘗試過?你看到什麼錯誤? – Nikhil
由於某種原因,這是工作'$ this-> data [$ this-> objs]' – mamolvary