\n"; while ($row_mod = sql_fetch_array($result)) { ob_start(); echo "\n"; ?>
'; } $output .= '
'; } $output .= ""; if ($use_cache) { $cache_dir = dirname($cache_file); if(!is_dir($cache_dir)){ @mkdir($cache_dir, 0777, true); @chmod($cache_dir,0755); } file_put_contents($cache_file, $output); file_put_contents($hash_file, $layout_checksum); } try { ob_start(); $eval_result = eval('?>' . $output); $eval_output = ob_get_clean(); if ($eval_output) { throw new Exception("eval() μ‹€ν–‰ 쀑 예기치 μ•Šμ€ 좜λ ₯이 λ°œμƒν–ˆμŠ΅λ‹ˆλ‹€: " . $eval_output); } $result_data[$layout_no] = $eval_result; } catch (ParseError $e) { $errors[] = "λ ˆμ΄μ•„μ›ƒ #{$layout_no} 처리 쀑 ꡬ문 였λ₯˜κ°€ λ°œμƒν–ˆμŠ΅λ‹ˆλ‹€: " . $e->getMessage(); if ($is_admin) { $errors[] = "--- μƒμ„±λœ μ½”λ“œ (일뢀) ---\n" . htmlspecialchars(substr($output, 0, 500)) . "..."; } } catch (Throwable $e) { $errors[] = "λ ˆμ΄μ•„μ›ƒ #{$layout_no} 처리 쀑 였λ₯˜κ°€ λ°œμƒν–ˆμŠ΅λ‹ˆλ‹€: " . $e->getMessage(); } } header('Content-Type: application/json; charset=utf-8'); if (!empty($errors)) { http_response_code(500); echo json_encode(['success' => false, 'message' => "λ ˆμ΄μ•„μ›ƒ 데이터 처리 쀑 μ„œλ²„ 였λ₯˜κ°€ λ°œμƒν–ˆμŠ΅λ‹ˆλ‹€.", 'errors' => $errors]); } else { echo json_encode($result_data); }