You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

38 lines
630 B

<?php
header('Content-Type: application/json');
require_once 'Day.php';
$dayNumber = $_GET['day'] ?? null;
$part = intval($_GET['part'] ?? 1);
if ($dayNumber){
$file = "days/Day$dayNumber.php";
if (file_exists($file)){
require_once $file;
$class = "Day$dayNumber";
/* @var $day Day */
$day = new $class();
$method = "part$part";
if (method_exists($day, $method)){
$t1 = microtime(true);
$result = $day->$method();
$t2 = microtime(true);
$time = $t2 - $t1;
$response = [
'result' => $result,
'time' => $time,
'data' => null
];
echo json_encode($response);
die();
}
}
}