开发者

Loading a method using a string variable

开发者 https://www.devze.com 2023-04-10 15:19 出处:网络
How can i work with something like: $parameter = \"get_something()\"; $value = $this->method->$parameter;

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

精彩评论

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