我试图通过这个循环
public static function CSS() {
$filenames = array(
"css/tableStyles.css"=>"function1()",
"css/resetCSS.css"=> "function2()"
);
foreach ($filenames as $filename=>$method){
CSS::$method;
}
}
public function1(){
//do something
}
public function2(){
//do something else
}
}
我收到运行时错误。有小费吗?
编辑:感谢arxanas,
答案是 :
$filenames = array(
"css/tableStyles.css"=>"function1",
"css/resetCSS.css"=> "function2"
);
foreach ($filenames as $filename=>$method){
CSS::$method();
}