CodeIgniter 4 PHP
Snippet PHP untuk CodeIgniter 4 yang menjawab request ke /pixel.gif dengan empty GIF, yang di-decode sekali saat startup.
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==')));
Kami telah menjalankan snippet ini dan membandingkan byte yang dikembalikannya.
Periksa
curl -sI http://localhost:8080/pixel.gif