冬十三博客网 - 源码
type: channel
link: https://blog.2su.cc/tag/%E6%BA%90%E7%A0%81/
items: 情商(EQ)测试
items: MBTI-16型人格测试

情商(EQ)测试
type: item
date: 2026-03-20T20:49:00+08:00
description: <?php /** * @title 情商(EQ)测试 * @description 专业情商测试与评估工具 * @tag 心理,EQ,情商测试 */ session_start(); // 初始化EQ测试数据 if (!isset($_SESSION['eq_version'])) { $_SESSION['eq_version'] = '1'; // 默认标准版 $_SESSION['eq_current_num'] = 1; $_SESSION['eq_answers'] = []; $_SESSION['eq_result'] = null; } // 处理开始测试请求 if (isset($_GET['action']) && $_GET['action'] === 'start_test') { $version = in_array($_GET['version'], ['1', '2']) ? $_GET['version'] : '1'; $_SESSION['eq_version'] = $version; $_SESSION['eq_current_num'] = 1; $_SESSION['eq_answers'] = []; $_SESSION['eq_result'] = null; echo json_encode(['success' => true, 'version' => $version]); exit; } // 处理获取题目请求 if (isset($_GET['action']) && $_GET['action'] === 'get_question') { $version = $_SESSION['eq_version'] ?? '1'; $num = $_SESSION['eq_current_num'] ?? 1; $questions = getEQQuestions($version); $max_questions = count($questions); if ($num <= $max_questions && isset($questions[$num])) { echo json_encode([ 'question' => $questions[$num]['question'], 'optionA' => $questions[$num]['optionA'], 'optionB' => $questions[$num]['optionB'], 'optionC' => $questions[$num]['optionC'], 'current_num' => $num, 'max_questions' => $max_questions ]); } else { echo json_encode(['error' => '题目不存在，请重试']); } exit; } // 处理保存答案请求 if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['action']) && $_POST['action'] === 'save_answer') { $answer = $_POST['answer'] ?? ''; $num = $_SESSION['eq_current_num'] ?? 1; $version = $_SESSION['eq_version'] ?? '1'; if (in_array($answer, ['A', 'B', 'C'])) { $_SESSION['eq_answers'][$num] = $answer; $_SESSION['eq_current_num'] = $num + 1; $questions = getEQQuestions($version); $max_questions = count($questions); $is_last_question = ($num >= $max_questions); echo json_encode([ 'success' => true, 'next_num' => $num + 1, 'is_last_question' => $is_last_question, 'max_questions' => $max_questions ]); } else { echo json_encode(['success' => false, 'error' => '无效答案']); } exit; } // 处理提交测试请求 if ($_SERVER['REQUEST_METHOD'] === 'POST'…

MBTI-16型人格测试
type: item
date: 2026-03-20T19:58:00+08:00
description: <?php /** * @title MBTI-16型人格测试 * @description MBTI人格类型测试工具 * @tag 心理,MBTI,人格测试 */ session_start(); // 初始化MBTI测试数据 if (!isset($_SESSION['mbti_version'])) { $_SESSION['mbti_version'] = '1'; // 默认基础版 $_SESSION['mbti_current_num'] = 1; $_SESSION['mbti_answers'] = []; $_SESSION['mbti_result'] = null; } // 处理开始测试请求 if (isset($_GET['action']) && $_GET['action'] === 'start_test') { $version = in_array($_GET['version'], ['1', '2', '3']) ? $_GET['version'] : '1'; $_SESSION['mbti_version'] = $version; $_SESSION['mbti_current_num'] = 1; $_SESSION['mbti_answers'] = []; $_SESSION['mbti_result'] = null; echo json_encode(['success' => true, 'version' => $version]); exit; } // 处理获取题目请求 if (isset($_GET['action']) && $_GET['action'] === 'get_question') { $version = $_SESSION['mbti_version'] ?? '1'; $num = $_SESSION['mbti_current_num'] ?? 1; $url = "https://cn.apihz.cn/api/mingli/mbti.php?id=88888888&key=88888888&type=1&version={$version}&num={$num}"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_TIMEOUT, 15); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); $response = curl_exec($ch); curl_close($ch); $data = json_decode($response, true); if ($data && $data['code'] === 200) { echo json_encode([ 'question' => $data['q'], 'optionA' => $data['a'], 'optionB' => $data['b'], 'current_num' => $num, 'max_questions' => getVersionMaxQuestions($version) ]); } else { echo json_encode([ 'error' => $data['msg'] ?? '获取题目失败，请重试', 'original_response' => $data ]); } exit; } // 处理保存答案请求 if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['action']) && $_POST['action'] === 'save_answer') { $answer = $_POST['answer'] ?? ''; $num = $_SESSION['mbti_current_num'] ?? 1; $version = $_SESSION['mbti_version'] ?? '1'; if ($answer === 'A' || $answer === 'B') { $_SESSION['mbti_answers'][$num] = $answer; $_SESSION['mbti_current_num'] = $num + 1; $max_questions = getVersionMaxQuestions($version); $is_last_question = ($num >= $ma…