23 lines
698 B
PHP
Executable File
23 lines
698 B
PHP
Executable File
<?php
|
|
class JsonToHtmlParser {
|
|
public function parseJsonFile($jsonFilePath) {
|
|
echo "Current working dir: " . getcwd() . "\n";
|
|
echo "Checking file at: $jsonFilePath\n";
|
|
|
|
$resolvedPath = realpath($jsonFilePath);
|
|
echo "Resolved file path: $resolvedPath\n";
|
|
|
|
if (!file_exists($resolvedPath)) {
|
|
die("JSON file not found at $resolvedPath\n");
|
|
}
|
|
|
|
echo "File found!\n";
|
|
$jsonData = json_decode(file_get_contents($resolvedPath), true);
|
|
if ($jsonData === null) {
|
|
die("Failed to decode JSON: " . json_last_error_msg());
|
|
}
|
|
|
|
return $this->buildHtml($jsonData);
|
|
}
|
|
}
|
|
?>
|