FrankenPHP (worker mode) PHP
FrankenPHP (worker mode)-এর জন্য একটি PHP স্নিপেট, যা /pixel.gif-এ আসা রিকোয়েস্টের উত্তরে empty GIF পাঠায়। GIF-টি স্টার্টআপে একবারই ডিকোড হয়।
FrankenPHP (worker mode) PHP
<?php
// Worker script: booted once, then handles requests in a loop.
ignore_user_abort(true);
$gif = base64_decode('R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==');
$handler = static function () use ($gif): void {
if (parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH) !== '/pixel.gif') {
http_response_code(404);
return;
}
header('Content-Type: image/gif');
header('Content-Length: ' . strlen($gif));
header('Cache-Control: no-store');
echo $gif;
};
while (frankenphp_handle_request($handler)) {
gc_collect_cycles();
}
আমরা এই স্নিপেট চালিয়েছি এবং এটি যে বাইটগুলো ফেরত দিয়েছে তা মিলিয়ে দেখেছি।
যাচাই করুন
curl -sI http://localhost:8080/pixel.gif
অফিশিয়াল সাইট: FrankenPHP (worker mode)