Tempest PHP
Snippet na PHP don Tempest da ke amsa requests zuwa /pixel.gif da empty GIF, wanda ake decoding ɗinsa sau ɗaya lokacin farawa.
Tempest PHP
<?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');
}
}
Mun gudanar da wannan snippet kuma mun kwatanta bytes ɗin da ya mayar.
Duba shi
curl -sI http://localhost:8080/pixel.gif