PHP使用字符串传递变量名和函数名

';
var_dump(call_user_func_array('showTime', []));
echo '
'; var_dump(call_user_func_array('time', [])); echo '
'; $data = ['status' => 1, 'info' => 'data is ok!', 'rows' => ['rowid' => 1]]; $variable = '$data'; $variable = substr($variable, 1); $variableParam = 'status'; $return = $$variable; var_dump($return); echo '
'; $value = $return[$variableParam]; var_dump($value); echo '
'; var_dump(call_user_func_array('showTime', [$value])); echo '
';

 

你可能感兴趣的:(PHP)