Files
adminer/adminer/include/tmpfile.inc.php

23 lines
428 B
PHP
Raw Normal View History

2013-05-01 09:33:23 -07:00
<?php
2025-03-05 11:28:53 +01:00
namespace Adminer;
2013-05-01 09:33:23 -07:00
class TmpFile {
2025-03-28 10:25:11 +01:00
/** @var resource */ private $handler;
2025-03-28 09:20:10 +01:00
/** @visibility protected(set) */ public int $size;
2025-02-21 13:53:18 +01:00
2015-08-15 17:04:21 +02:00
function __construct() {
2013-05-01 09:33:23 -07:00
$this->handler = tmpfile();
}
2025-02-21 13:53:18 +01:00
function write(string $contents): void {
2013-05-01 09:33:23 -07:00
$this->size += strlen($contents);
fwrite($this->handler, $contents);
}
2025-02-21 13:53:18 +01:00
function send(): void {
2013-05-01 09:33:23 -07:00
fseek($this->handler, 0);
fpassthru($this->handler);
fclose($this->handler);
}
}