我怎样才能完成这项工作,我不知道为什么它不起作用
public function generateCourse($course, $type) {
$this->runFunction($this->generateHole($hole), $type);
}
public function runFunction($function, $type) {
switch ($type){
case 0:
for ($hole = 0; $hole < 18; $hole++) {
$function;
}
break;
答案 0 :(得分:0)
试试这个
public function runFunction($function, $type) {
switch ($type){
case 0:
for ($hole = 0; $hole < 18; $hole++) {
$function();
}
或使用此
调用该函数call_user_func($function);