获取当前目录下所有php文件内的函数名

$dir =  dirname(__FILE__);

$files = scandir($dir);

foreach($files as $name){
if($name == '.' || $name == '..'){
continue;
}
$title = preg_replace("/Controller.*?php/",'',$name);
$file = fopen($name,"r"); $content = array(); while(!feof($file)){
$line_content = fgets($file);
preg_match("/public\s+function/", $line_content, $pat_array);
if(isset($pat_array[0])){
$line_content = preg_replace("/.*?function\b|\(.*?{|\s+/",'',$line_content); $content[] = $title.'/'.$line_content;
}
} fclose($file); print_r($content);
}
上一篇:wireshark 抓包分析 TCPIP协议的握手


下一篇:vue+element-ui之tree树形控件有关子节点和父节点之间的各种选中关系详解