add(new DateInterval('P4885D')); $dateStr = $today->format('Ymd'); // 해시 생성할 문자열 (날짜 + 비밀 키) $secretKey = "who"; $rawData = $dateStr . $secretKey; // SHA-256 해시 생성 (Google Apps Script와 동일) $hash = hash('sha256', $rawData); // 앞 4자리 사용 return substr($hash, 0, 4); } try { $authKey = generateAuthKey(); echo json_encode([ 'success' => true, 'authKey' => $authKey ]); } catch (Exception $e) { echo json_encode([ 'success' => false, 'error' => $e->getMessage() ]); } ?>