mirror of
https://github.com/macintoshplus/doc-fr.git
synced 2026-03-25 17:32:07 +01:00
126 lines
3.4 KiB
XML
126 lines
3.4 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<!-- EN-Revision: fda6c4efe20f441b2412e9dc37361e3cf25dcab9 Maintainer: yannick 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>Construit un nouvel objet représentant un fichier temporaire</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<constructorsynopsis>
|
|
<modifier>public</modifier> <methodname>SplTempFileObject::__construct</methodname>
|
|
<methodparam choice="opt"><type>int</type><parameter>maxMemory</parameter><initializer>2 * 1024 * 1024</initializer></methodparam>
|
|
</constructorsynopsis>
|
|
<para>
|
|
Construit un nouvel objet représentant un fichier temporaire.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>maxMemory</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
La mémoire maximale (en octets, par défaut, 2 Mo) à utiliser
|
|
pour le fichier temporaire. Si un fichier temporaire dépasse
|
|
cette taille, il sera déplacé sur le système de fichiers, dans
|
|
le dossier des fichiers temporaires.
|
|
</para>
|
|
<para>
|
|
Si <parameter>maxMemory</parameter> est négatif, seule la
|
|
mémoire sera utilisée. Si <parameter>maxMemory</parameter> vaut
|
|
zéro, la mémoire ne sera pas utilisée.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="errors">
|
|
&reftitle.errors;
|
|
<para>
|
|
Lance un exception <classname>RuntimeException</classname>
|
|
si une erreur survient.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title>Exemple avec <methodname>SplTempFileObject</methodname></title>
|
|
<para>
|
|
Cet exemple écrit un fichier temporaire en mémoire dans lequel nous allons
|
|
pouvoir écrire et lire des données.
|
|
</para>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$temp = new SplTempFileObject();
|
|
$temp->fwrite("This is the first line\n");
|
|
$temp->fwrite("And this is the second.\n");
|
|
echo $temp->ftell() . " octets écrits dans le fichier temporaire.\n\n";
|
|
|
|
// Rewind and read what was written
|
|
$temp->rewind();
|
|
foreach ($temp as $line) {
|
|
echo $line;
|
|
}
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs.similar;
|
|
<screen>
|
|
<![CDATA[
|
|
47 octets écrits dans le fichier temporaire.
|
|
|
|
This is the first line
|
|
And this is the second.
|
|
]]>
|
|
</screen>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><classname>SplFileObject</classname></member>
|
|
<member>
|
|
<link linkend="wrappers.php">Flux PHP input/output</link>
|
|
(pour <literal>php://temp</literal> et <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
|
|
-->
|