mirror of
https://github.com/macintoshplus/doc-fr.git
synced 2026-03-24 17:02:18 +01:00
150 lines
3.9 KiB
XML
150 lines
3.9 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- EN-Revision: 0545e305cf06937b14b3f0694d6e716c9881ffd7 Maintainer: yannick Status: ready -->
|
|
<!-- Reviewed: yes -->
|
|
<refentry xml:id="ziparchive.addfromstring" xmlns="http://docbook.org/ns/docbook">
|
|
<refnamediv>
|
|
<refname>ZipArchive::addFromString</refname>
|
|
<refpurpose>Ajoute un fichier à une archive ZIP en utilisant son contenu</refpurpose>
|
|
</refnamediv>
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis role="ZipArchive">
|
|
<modifier>public</modifier> <type>bool</type><methodname>ZipArchive::addFromString</methodname>
|
|
<methodparam><type>string</type><parameter>name</parameter></methodparam>
|
|
<methodparam><type>string</type><parameter>content</parameter></methodparam>
|
|
<methodparam choice="opt"><type>int</type><parameter>flags</parameter><initializer>ZipArchive::FL_OVERWRITE</initializer></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Ajoute un fichier à une archive ZIP en utilisant son contenu.
|
|
</para>
|
|
&zip.filename.separator;
|
|
</refsect1>
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>name</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Le nom de l'entrée à créer
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>content</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Le contenu à utiliser pour créer l'entrée. Ceci est utilisé dans un
|
|
mode binaire sécurisé.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>flags</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Masque de bit consistant de
|
|
<constant>ZipArchive::FL_OVERWRITE</constant>,
|
|
<constant>ZipArchive::FL_ENC_GUESS</constant>,
|
|
<constant>ZipArchive::FL_ENC_UTF_8</constant>,
|
|
<constant>ZipArchive::FL_ENC_CP437</constant>.
|
|
Le comportement de ces constantes est décrites sur la page des
|
|
<link linkend="zip.constants">constantes ZIP</link>.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
&return.success;
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="changelog">
|
|
&reftitle.changelog;
|
|
<para>
|
|
<informaltable>
|
|
<tgroup cols="2">
|
|
<thead>
|
|
<row>
|
|
<entry>&Version;</entry>
|
|
<entry>&Description;</entry>
|
|
</row>
|
|
</thead>
|
|
<tbody>
|
|
<row>
|
|
<entry>8.0.0 / PECL zip 1.18.0</entry>
|
|
<entry>
|
|
<parameter>flags</parameter> a été ajouté.
|
|
</entry>
|
|
</row>
|
|
</tbody>
|
|
</tgroup>
|
|
</informaltable>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<example>
|
|
<title>Ajout d'une entrée dans une nouvelle archive</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$zip = new ZipArchive;
|
|
$res = $zip->open('test.zip', ZipArchive::CREATE);
|
|
if ($res === TRUE) {
|
|
$zip->addFromString('test.txt', 'contenu du fichier ici');
|
|
$zip->close();
|
|
echo 'ok';
|
|
} else {
|
|
echo 'échec';
|
|
}
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
<example>
|
|
<title>Ajout d'un fichier dans un dossier d'une archive</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$zip = new ZipArchive;
|
|
if ($zip->open('test.zip') === TRUE) {
|
|
$zip->addFromString('dir/test.txt', 'contenu du fichier ici');
|
|
$zip->close();
|
|
echo 'ok';
|
|
} else {
|
|
echo 'échec';
|
|
}
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</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
|
|
-->
|