emptygif
Lugha: Kiswahili

Lugha na framework zote

Tempest PHP

Kipande cha PHP kwa Tempest kinachojibu maombi ya /pixel.gif kwa empty GIF, ambayo husimbuliwa (decode) mara moja programu inapoanza.

Tempest PHP

Sakinisha
composer create-project tempest/app my-app
Faili
PixelController.php
Endesha
php tempest serve
<?php
// app/PixelController.php: Tempest discovers the #[Get] route, no registration needed.

namespace App;

use Tempest\Http\Response;
use Tempest\Http\Responses\Ok;
use Tempest\Router\Get;

final readonly class PixelController
{
    #[Get('/pixel.gif')]
    public function __invoke(): Response
    {
        return new Ok(base64_decode('R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='))
            ->addHeader('Content-Type', 'image/gif')
            ->addHeader('Cache-Control', 'no-store');
    }
}

Tuliendesha kipande hiki na kulinganisha baiti kilizorudisha.

Kagua

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

Tovuti rasmi: Tempest

Zaidi katika PHP