c2180add33b22108873d52c7f38aafabef2ee576
[yaffs-website] / vendor / caxy / php-htmldiff / demo / load_table_diff.php
1 <?php
2
3 $requestBody = file_get_contents('php://input');
4
5 $requestJson = json_decode($requestBody, true);
6
7 if (empty($requestJson['index'])) {
8     throw new \Exception('index is required.');
9 }
10
11 $jsonFile = __DIR__.'/tablediffs.json';
12
13 $demoStorage = json_decode(file_get_contents($jsonFile), true);
14
15 if (!array_key_exists($requestJson['index'], $demoStorage)) {
16     throw new \Exception('index not found.');
17 }
18
19 $targetDemo = $demoStorage[$requestJson['index']];
20
21 header('Content-Type: application/json');
22 echo json_encode($targetDemo);