Пример #1
0
$scan_path = str_replace(array('\\', '//'), '/', $scan_path);
$fileName = str_replace('/', '_', $scan_path);
$fileName = str_replace(':', '_', $fileName);
$serialPath = CURR_PATH . "/data/resultConetxtSerialData/" . $fileName;
if (!is_file($serialPath)) {
    //创建文件
    $fileHandler = fopen($serialPath, 'w');
    fclose($fileHandler);
}
$results = null;
if (($serial_str = file_get_contents($serialPath)) != '') {
    $results = unserialize($serial_str);
} else {
    //3、初始化模块
    $allFiles = FileUtils::getPHPfile($project_path);
    $mainlFiles = FileUtils::mainFileFinder($scan_path);
    $initModule = new InitModule();
    $initModule->init($project_path, $allFiles);
    //4、循环每个文件  进行分析工作
    if (is_file($project_path)) {
        load_file($project_path);
    } elseif (is_dir($project_path)) {
        $path_list = $mainlFiles;
        foreach ($path_list as $path) {
            try {
                load_file($path);
            } catch (Exception $e) {
                continue;
            }
        }
    } else {