mirror of
https://github.com/macintoshplus/doc-fr.git
synced 2026-03-26 01:42:09 +01:00
git-svn-id: https://svn.php.net/repository/phpdoc/fr/trunk@350667 c90b9560-bf6c-de11-be94-00142212c4b1
164 lines
4.4 KiB
XML
164 lines
4.4 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<!-- EN-Revision: 3e15d2894fb35432d2a111db36fe8ba8ebc62024 Maintainer: gui Status: ready -->
|
|
<!-- Reviewed: no -->
|
|
|
|
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="phar.setstub">
|
|
<refnamediv>
|
|
<refname>Phar::setStub</refname>
|
|
<refpurpose>Utilisé pour spécifier le chargeur PHP ou le conteneur de chargement d'une archive Phar</refpurpose>
|
|
</refnamediv>
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<modifier>public</modifier> <type>bool</type><methodname>Phar::setStub</methodname>
|
|
<methodparam><type>string</type><parameter>stub</parameter></methodparam>
|
|
<methodparam choice="opt"><type>int</type><parameter>len</parameter><initializer>-1</initializer></methodparam>
|
|
</methodsynopsis>
|
|
&phar.write;
|
|
|
|
|
|
<para>
|
|
Cette méthode est utilisée pour ajouter un chargeur PHP à une nouvelle archive Phar, ou
|
|
pour remplacer le conteneur de chargement d'une archive Phar existante.
|
|
</para>
|
|
<para>
|
|
Le conteneur de chargement d'une archive Phar est utilisé quand une archive est incluse directement
|
|
comme dans cet exemple :
|
|
</para>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
include 'monphar.phar';
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
<para>
|
|
Le chargeur n'est pas utilisé quand un fichier est inclus via le flux <literal>phar</literal>
|
|
comme ceci :
|
|
</para>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
include 'phar://monphar.phar/unfchier.php';
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>stub</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Une chaîne ou une &resource; de flux ouvert à utiliser
|
|
comme conteneur exécutable pour cette archive phar.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>len</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
&return.success;
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="errors">
|
|
&reftitle.errors;
|
|
<para>
|
|
Une exception <classname>UnexpectedValueException</classname> est levée si
|
|
<link linkend="ini.phar.readonly">phar.readonly</link> est activé dans
|
|
le php.ini.
|
|
Une exception <classname>PharException</classname> est levée si des problèmes sont rencontrés lors de
|
|
l'écriture des changement sur le disque.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title>Un exemple avec <function>Phar::setStub</function></title>
|
|
<para>
|
|
</para>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
try {
|
|
$p = new Phar(dirname(__FILE__) . '/nouveau.phar', 0, 'nouveau.phar');
|
|
$p['a.php'] = '<?php var_dump("Salut");';
|
|
$p->setStub('<?php var_dump("Premier"); Phar::mapPhar("nouveau.phar"); __HALT_COMPILER(); ?>');
|
|
include 'phar://nouveau.phar/a.php';
|
|
var_dump($p->getStub());
|
|
$p['b.php'] = '<?php var_dump("Tout le monde");';
|
|
$p->setStub('<?php var_dump("Second"); Phar::mapPhar("nouveau.phar"); __HALT_COMPILER(); ?>');
|
|
include 'phar://nouveau.phar/b.php';
|
|
var_dump($p->getStub());
|
|
} catch (Exception $e) {
|
|
echo 'Erreur lors de l'écriture de nouveau.phar: ', $e;
|
|
}
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs;
|
|
<screen>
|
|
<![CDATA[
|
|
string(5) "Salut"
|
|
string(79) "<?php var_dump("Premier"); Phar::mapPhar("nouveau.phar"); __HALT_COMPILER(); ?>"
|
|
string(13) "Tout le monde"
|
|
string(78) "<?php var_dump("Second"); Phar::mapPhar("nouveau.phar"); __HALT_COMPILER(); ?>"
|
|
]]>
|
|
</screen>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><function>Phar::getStub</function></member>
|
|
<member><function>Phar::createDefaultStub</function></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
|
|
-->
|