PHP获取所有扩展及扩展下的所有函数签名生成php.snippet
1 <?php 2 $ext_info = array(); 3 $modules = get_loaded_extensions(); 4 foreach ($modules as $module) { 5 $functions = get_extension_funcs($module); 6 if (empty($functions) || !is_array($functions)) { 7 continue; 8 } 9 foreach ($functions as $fun) { 10 $reflect = new ReflectionFunction($fun); 11 $params = $reflect->getParameters();//获取函数参数信息 12 $param_str = ''; 13 $param_num = 0; 14 if (!empty($params) && is_array($params) && count($params)>0) { 15 foreach($params as $key=>$param) { 16 if($param->getName() !== '') { 17 $param_str .= '$${'.($key+1).':'.$param->getName().'}, '; 18 } 19 $param_num++; 20 } 21 $param_str = substr($param_str, 0, -2); 22 } 23 if (empty($param_str)) { 24 echo "snippet $fun\n"; 25 echo "\t".$fun.'('.$param_str.')${1}'."\n"; 26 } else { 27 echo "snippet $fun\n"; 28 echo "\t".$fun.'('.$param_str.')${'.($param_num+1).'}'."\n"; 29 } 30 } 31 }
!!!我的新站地址点击这里,欢迎光顾!!!