wp-visitor-contributions/vendor/caxy/php-htmldiff/demo/load_table_diff.php

23 lines
535 B
PHP

2016-07-12 16:58:19 -05:00
<?php
$requestBody = file_get_contents('php://input');
$requestJson = json_decode($requestBody, true);
if (empty($requestJson['index'])) {
throw new \Exception('index is required.');
}
$jsonFile = __DIR__.'/tablediffs.json';
$demoStorage = json_decode(file_get_contents($jsonFile), true);
if (!array_key_exists($requestJson['index'], $demoStorage)) {
throw new \Exception('index not found.');
}
$targetDemo = $demoStorage[$requestJson['index']];
header('Content-Type: application/json');
echo json_encode($targetDemo);