mirror of
https://github.com/php/doc-es.git
synced 2026-03-24 07:22:16 +01:00
119 lines
3.3 KiB
XML
119 lines
3.3 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- EN-Revision: d51166ca16fda8e766849505b84f9306ef443f71 Maintainer: andresdzphp Status: ready -->
|
|
<!-- Reviewed: no -->
|
|
<refentry xml:id="spltempfileobject.construct" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
<refnamediv>
|
|
<refname>SplTempFileObject::__construct</refname>
|
|
<refpurpose>Construir un nuevo objeto de fichero temporal</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<constructorsynopsis role="SplTempFileObject">
|
|
<modifier>public</modifier> <methodname>SplTempFileObject::__construct</methodname>
|
|
<methodparam choice="opt"><type>int</type><parameter>maxMemory</parameter><initializer>2 * 1024 * 1024</initializer></methodparam>
|
|
</constructorsynopsis>
|
|
<para>
|
|
Construir un nuevo objeto de fichero temporal.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>maxMemory</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
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.
|
|
</para>
|
|
<para>
|
|
Si <parameter>maxMemory</parameter> es negativo, se usará memoria.
|
|
Si <parameter>maxMemory</parameter> es cero, no se usará memoria.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="errors">
|
|
&reftitle.errors;
|
|
<para>
|
|
Lanza una <classname>RuntimeException</classname> si un error ocurre.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title>Ejemplo de <methodname>SplTempFileObject</methodname></title>
|
|
<para>Este ejemplo escribe un fichero temporal en la memoria mientras se puede escribir y leer en este.</para>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$temp = new SplTempFileObject();
|
|
$temp->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;
|
|
}
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs.similar;
|
|
<screen>
|
|
<![CDATA[
|
|
Escrito 47 bytes al fichero temporal.
|
|
|
|
Esta es la primera línea
|
|
Y esta es la segunda.
|
|
]]>
|
|
</screen>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><classname>SplFileObject</classname></member>
|
|
<member>
|
|
<link linkend="wrappers.php">PHP input/output streams</link>
|
|
(para <literal>php://temp</literal> y <literal>php://memory</literal>)
|
|
</member>
|
|
</simplelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
</refentry>
|
|
<!-- Keep this comment at the end of the file
|
|
Local variables:
|
|
mode: sgml
|
|
sgml-omittag:t
|
|
sgml-shorttag:t
|
|
sgml-minimize-attributes:nil
|
|
sgml-always-quote-attributes:t
|
|
sgml-indent-step:1
|
|
sgml-indent-data:t
|
|
indent-tabs-mode:nil
|
|
sgml-parent-document:nil
|
|
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
|
|
sgml-exposed-tags:nil
|
|
sgml-local-catalogs:nil
|
|
sgml-local-ecat-files:nil
|
|
End:
|
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
|
vim: et tw=78 syn=sgml
|
|
vi: ts=1 sw=1
|
|
-->
|