Added PHP version check

This commit is contained in:
simonmicro
2023-05-23 22:57:01 +02:00
parent 3f7fa53eb3
commit 34ff12f64f

View File

@@ -15,7 +15,10 @@ $clientVersion = isset($body->version) ? $body->version : null;
// Fake API
$result = null;
if(isset($_GET['path'])) {
if (version_compare(PHP_VERSION, '8.0.0', '<')) {
$result = array('error_msg' => 'This API only supports PHP 8 or higher.');
$code = 500;
} else if(isset($_GET['path'])) {
$path = trim($_GET['path'], ' /');
$pathParts = explode('/', $_GET['path']);
if(count($pathParts) > 0 && $pathParts[0] == 'healthz') {