使用字符串变量加载方法

时间:2011-10-01 21:45:19

标签: php oop

我如何使用以下内容:

$parameter = "get_something()";

$value = $this->method->$parameter;

我收到错误“undefined property $ get_something()”(注意$)。

1 个答案:

答案 0 :(得分:4)

尝试使用

$name = "get_something";
$value = $this->method->$name();

代替