【发布时间】:2018-06-10 00:08:41
【问题描述】:
好的,所以我想通了 :) 多亏了您的示例,它现在应该如何工作。
class Test_Class {
public function Test_Function_1(array $Test_Array_1) {
echo'TF1_Var_1 = '. $Test_Array_1['TF1_Var_1'] . '<br> <br>';
}
public function Test_Function_2($Test_Selector_2, array $Test_Array_2) {
echo'Test_Selector_2 = '. $Test_Selector_2 . '<br>';
echo'TF2_Var_1 = '. $Test_Array_2['TF2_Var_1'] . '<br>';
}
}
$Test_Run = new Test_Class();
$Test_Run->Test_Function_1([ 'TF1_Var_1' => 'TF1_Val_1', 'TF1_Var_2' => 'TF1_Val_2', 'TF1_Var_3' => 'TF1_Val_3' ]);
$Test_Run->Test_Function_2('TF2_Selector_Data' , [ 'TF2_Var_1' => 'TF2_Val_1', 'TF2_Var_2' => 'TF2_Val_2', 'TF2_Var_3' => 'TF2_Val_3' ]);
我实际上没有意识到你可以将数组传递给函数,我以前没有遇到过这样的例子,所以我不知道这是可能的。 我以为你只能用逗号分隔字符串,所以谢谢。
【问题讨论】: