2011年4月7日 星期四

[PHP] call_user_func_array 介紹

使用 call_user_func_array 來call 自己設定的function .


helper_call_custom_function('test');

function helper_call_custom_function( $p_function, $p_args_array ) {
$t_function = 'custom_function_override_' . $p_function;

if( !function_exists( $t_function ) ) {
$t_function = 'custom_function_default_' . $p_function;
}

return call_user_func_array( $t_function, $p_args_array );
}

function custom_function_default_test($p_args_array , $xxx = CUSTOM_VALUE){
xxx....
}

【下列文章您可能也有興趣】

沒有留言: