class sample{ public static function add_action_func(){ //注意__CLASS__还将包括任何命名空间 add_action('init', array(__CLASS__, 'samp') ); } public static function samp(){ echo 'i did something'; } } sample::add_action_func();