【发布时间】:2014-08-30 16:49:42
【问题描述】:
$model = JModelLegacy::getInstance('NameOfModel', $prefix = 'my_componentModel', $config = array());
通常,我会这样调用模型方法:
$this->items = $model->my_method();
就我而言,我需要通过变量调用方法,因为它是动态的:
$this->items = $model->$variable; ...but this won't work.
$this->items = $model->{$variable}; ...this also won't work.
有人知道怎么解决吗?
【问题讨论】:
标签: php variables methods joomla call