emptygif
ભાષા: ગુજરાતી

બધી ભાષાઓ અને ફ્રેમવર્ક

CodeIgniter 4 PHP

CodeIgniter 4 માટે PHP સ્નિપેટ, જે /pixel.gif પરની રિક્વેસ્ટનો જવાબ empty GIF થી આપે છે. GIF સ્ટાર્ટઅપ વખતે એક જ વાર ડિકોડ થાય છે.

CodeIgniter 4 PHP

ઇન્સ્ટૉલ
composer create-project codeigniter4/appstarter my-app
ફાઇલ
Routes.php
ચલાવો
php spark serve
<?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==')));

અમે આ સ્નિપેટ ચલાવ્યો અને તેણે પરત કરેલા બાઇટની સરખામણી કરી.

ચકાસો

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

સત્તાવાર સાઇટ: CodeIgniter 4

PHP માં વધુ