scan(); echo "找到 " . count($definitionFiles) . " 个有效定义文件:\n"; foreach ($definitionFiles as $file) { echo " - $file\n"; } // 测试扫描所有 PHP 文件(不检查语法) echo "\n扫描所有 PHP 文件(不检查语法):\n"; $scanner2 = new FileScanner($testDir, ['.php'], false); // 不启用语法检查 $allFiles = $scanner2->scan(); echo "找到 " . count($allFiles) . " 个文件:\n"; foreach ($allFiles as $file) { echo " - $file\n"; } // 清理测试文件 unlink($definitionFile); unlink($executableFile); rmdir($testDir); } catch (Exception $e) { echo "错误: " . $e->getMessage() . "\n"; // 清理测试文件(如果出错) if (file_exists($definitionFile)) unlink($definitionFile); if (file_exists($executableFile)) unlink($executableFile); if (is_dir($testDir)) rmdir($testDir); }