Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function get_fileCities()
- {
- $filePath = __DIR__ . '/../../cities.txt';
- if (!file_exists($filePath)) {
- file_put_contents($filePath, '');
- }
- $data = file_get_contents($filePath);
- header('Content-Type: application/json');
- if ($data) {
- echo json_encode(explode(',', $data));
- } else {
- echo json_encode([]);
- }
- }
- public function get_updateFileCities()
- {
- $filePath = __DIR__ . '/../../cities.txt';
- if (isset($_GET['cityIds'])) {
- $cityIds = $_GET['cityIds'];
- file_put_contents($filePath, $cityIds);
- header('Content-Type: application/json');
- echo json_encode(['status' => 'success']);
- } else {
- header('Content-Type: application/json');
- echo json_encode(['status' => 'error', 'message' => 'No city IDs provided']);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement