function file_get_php_classes($filepath) { $php_pre = file_get_contents($filepath); $classes = get_php_classes($php_pre); return $classes;}function get_php_classes($php_pre) { $classes = array(); $tokens = token_get_all($php_pre); $count = count($tokens); for ($i = 2; $i < $count; $i++) { if ( $tokens[$i - 2][0] == T_CLASS && $tokens[$i - 1][0] == T_WHITESPACE && $tokens[$i][0] == T_STRING) { $class_name = $tokens[$i][1]; $classes[] = $class_name; } } return $classes;}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)