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 语法检查..."
errors=0
for file in $(find . -name "*.php" -not -path "./vendor/*"); do
output=$(php -l "$file" 2>&1)
if [ $? -ne 0 ]; then
echo "错误: $file"
echo "$output"
if ! php -l "$file" > /dev/null 2>&1; then
echo "❌ 语法错误: $file"
php -l "$file" || true
errors=$((errors + 1))
fi
done
+1 -1
View File
@@ -1,5 +1,5 @@
<?php
require_once 'config.php' // 缺少分号,引入语法错误
require_once 'config.php';
// 已登录则跳转到主页
if (isset($_SESSION['user_id'])) {