CodeIgniter 4 PHP
Snippet na PHP don CodeIgniter 4 da ke amsa requests zuwa /pixel.gif da empty GIF, wanda ake decoding ɗinsa sau ɗaya lokacin farawa.
CodeIgniter 4 PHP
<?php
// app/Config/Routes.php
use CodeIgniter\Router\RouteCollection;
/** @var RouteCollection $routes */
$routes->get('/', 'Home::index');
$routes->get('/pixel.gif', static fn () => service('response')
->setContentType('image/gif', '')
->setHeader('Cache-Control', 'no-store')
->setBody(base64_decode('R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==')));
Mun gudanar da wannan snippet kuma mun kwatanta bytes ɗin da ya mayar.
Duba shi
curl -sI http://localhost:8080/pixel.gif