emptygif
Sprache: Deutsch

Alle Sprachen und Frameworks

Plain PHP (php-fpm, mod_php, php -S) PHP

Ein PHP-Snippet für Plain PHP (php-fpm, mod_php, php -S), das Anfragen an /pixel.gif mit dem leeren GIF beantwortet, das einmal beim Start dekodiert wird.

Plain PHP (php-fpm, mod_php, php -S) PHP

Datei
index.php
Ausführen
php -S 0.0.0.0:8080 index.php
<?php

// Front controller: works under php-fpm, Apache mod_php or the built-in server.
if (parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH) !== '/pixel.gif') {
    http_response_code(404);
    return;
}

$gif = base64_decode('R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==');

header('Content-Type: image/gif');
header('Content-Length: ' . strlen($gif));
header('Cache-Control: no-store');
echo $gif;

Wir haben dieses Snippet ausgeführt und die zurückgegebenen Bytes verglichen.

Prüfen

curl -sI http://localhost:8080/pixel.gif

Offizielle Website: Plain PHP (php-fpm, mod_php, php -S)

Mehr in PHP