fix: 改进 PHP 语法检查错误信息输出
Test CI / 快速测试 (push) Successful in 10s

This commit is contained in:
2026-03-01 23:42:25 +08:00
parent 156291ac8c
commit 9f05541fa8
2 changed files with 4 additions and 5 deletions
+3 -4
View File
@@ -25,10 +25,9 @@ jobs:
echo "📝 PHP 语法检查..." echo "📝 PHP 语法检查..."
errors=0 errors=0
for file in $(find . -name "*.php" -not -path "./vendor/*"); do for file in $(find . -name "*.php" -not -path "./vendor/*"); do
output=$(php -l "$file" 2>&1) if ! php -l "$file" > /dev/null 2>&1; then
if [ $? -ne 0 ]; then echo "❌ 语法错误: $file"
echo "错误: $file" php -l "$file" || true
echo "$output"
errors=$((errors + 1)) errors=$((errors + 1))
fi fi
done done
+1 -1
View File
@@ -1,5 +1,5 @@
<?php <?php
require_once 'config.php' // 缺少分号,引入语法错误 require_once 'config.php';
// 已登录则跳转到主页 // 已登录则跳转到主页
if (isset($_SESSION['user_id'])) { if (isset($_SESSION['user_id'])) {