获取当前目录下所有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); }