SplTempFileObject::__constructConstruir un nuevo objeto de fichero temporal
&reftitle.description;
publicSplTempFileObject::__constructintmaxMemory2 * 1024 * 1024
Construir un nuevo objeto de fichero temporal.
&reftitle.parameters;
maxMemory
La cantidad máxima de memoria (en bytes, por omisión es 2 MB) para
el fichero temporal a usar. Su el fichero temporal supera este tamaño,
Este será movido a un archivo en el directorio temporal del sistema.
Si maxMemory es negativo, se usará memoria.
Si maxMemory es cero, no se usará memoria.
&reftitle.errors;
Lanza una RuntimeException si un error ocurre.
&reftitle.examples;
Ejemplo de SplTempFileObjectEste ejemplo escribe un fichero temporal en la memoria mientras se puede escribir y leer en este.
fwrite("Esta es la primera línea\n");
$temp->fwrite("Y esta es la segunda.\n");
echo "Escrito " . $temp->ftell() . " bytes al fichero temporal.\n\n";
// Rebobina y lee lo que fué escrito
$temp->rewind();
foreach ($temp as $line) {
echo $line;
}
?>
]]>
&example.outputs.similar;
&reftitle.seealso;
SplFileObject
PHP input/output streams
(para php://temp y php://memory)