Files
sam-kd/instock/save_lotnum.php

21 lines
632 B
PHP
Raw Permalink Normal View History

<?php
// JSON 응답 형식 설정
header('Content-Type: application/json');
// 입력 데이터 검증
if (!isset($_POST['lot_no'])) {
echo json_encode(['status' => 'error', 'message' => 'No data provided']);
exit;
}
$lot_no = $_POST['lot_no']; // 클라이언트에서 받은 로트번호
$filepath = $_SERVER['DOCUMENT_ROOT'] . '/instock/lotnum.txt';
// 파일에 데이터 저장
if (file_put_contents($filepath, $lot_no) !== false) {
echo json_encode(['status' => 'success', 'message' => 'Data saved successfully']);
} else {
echo json_encode(['status' => 'error', 'message' => 'Failed to save data']);
}
?>