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

28 lines
477 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-26 21:06:01 +01:00
/** @var resource */ private $handler;
/** @var int @visibility protected(set) */ public $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
2025-03-26 21:06:01 +01:00
/**
* @param string
* @return void
*/
2013-05-01 09:33:23 -07:00
function write($contents) {
$this->size += strlen($contents);
fwrite($this->handler, $contents);
}
2025-02-21 13:53:18 +01:00
2025-03-26 21:06:01 +01:00
/** @return void */
2013-05-01 09:33:23 -07:00
function send() {
fseek($this->handler, 0);
fpassthru($this->handler);
fclose($this->handler);
}
}