开发者

Loading a method using a string variable

How can i work with something like:

$parameter = "get_something()";

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

I'm getting the er开发者_如何学编程ror "undefined property $get_something()" (note the $).


Try to use

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

instead

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜