emptygif
Wika: Filipino

Lahat ng language at framework

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

Isang PHP snippet para sa Plain PHP (php-fpm, mod_php, php -S) na sumasagot sa mga request sa /pixel.gif gamit ang empty GIF, na isang beses lang dine-decode sa startup.

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

File
index.php
Patakbuhin
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;

Pinatakbo namin ang snippet na ito at ikinumpara ang mga byte na ibinalik nito.

Suriin

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

Opisyal na site: Plain PHP (php-fpm, mod_php, php -S)

Iba pa sa PHP