目前有效:
$get_pending_list_action = "get_pending_list_".$action;
$data = $this->sectorswaps->{$get_pending_list_action}($list);
无论如何要做到这一点我可以把它变成一行吗?
即。这不起作用:
$data = $this->sectorswaps->get_pending_list_{$action}($list);
还有其他一些我不知道的方式吗?
答案 0 :(得分:2)
$data = $this->sectorswaps->{"get_pending_list_".$action}($list);