mirror of
https://github.com/php/doc-es.git
synced 2026-03-24 07:22:16 +01:00
115 lines
3.3 KiB
XML
115 lines
3.3 KiB
XML
<?xml version='1.0' encoding='utf-8'?>
|
|
<!-- EN-Revision: f03806fcd8fe03a0501bd40b6e3939ff6589a1d2 Maintainer: PhilDaiguille Status: ready -->
|
|
<!-- Reviewed: no -->
|
|
<refentry xml:id="pharfileinfo.construct" xmlns="http://docbook.org/ns/docbook">
|
|
<refnamediv>
|
|
<refname>PharFileInfo::__construct</refname>
|
|
<refpurpose>Construye un objeto de entrada Phar</refpurpose>
|
|
</refnamediv>
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<constructorsynopsis role="PharFileInfo">
|
|
<modifier>public</modifier> <methodname>PharFileInfo::__construct</methodname>
|
|
<methodparam><type>string</type><parameter>filename</parameter></methodparam>
|
|
</constructorsynopsis>
|
|
<para>
|
|
Este método no debe ser llamado directamente. En su lugar, un objeto
|
|
<classname>PharFileInfo</classname> es inicializado llamando
|
|
<function>Phar::offsetGet</function> mediante un acceso de tipo array.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>filename</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
La URL completa para recuperar un fichero. Si se desea recuperar
|
|
la información del fichero <literal>mon/fichier.php</literal>
|
|
del phar <literal>boo.phar</literal>, se deberá especificar
|
|
<literal>phar://boo.phar/mon/fichier.php</literal>.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="errors">
|
|
&reftitle.errors;
|
|
<para>
|
|
Genera una excepción <classname>BadMethodCallException</classname> si
|
|
<link linkend="object.construct">__construct()</link> es llamado dos veces.
|
|
Genera una excepción <classname>UnexpectedValueException</classname> si
|
|
la URL del phar solicitado está mal formada, si el phar no puede ser abierto o
|
|
si el fichero no puede ser encontrado dentro del phar.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title>Ejemplo con <function>PharFileInfo::__construct</function></title>
|
|
<para>
|
|
</para>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
try {
|
|
$p = new Phar('/ruta/hacia/mon.phar', 0, 'mon.phar');
|
|
$p['fichierdetest.txt'] = "hola\nmi\namigo";
|
|
$file = $p['fichierdetest.txt'];
|
|
foreach ($file as $line => $text) {
|
|
echo "línea número $line: $text";
|
|
}
|
|
// esto también funciona
|
|
$file = new PharFileInfo('phar:///ruta/hacia/mon.phar/fichierdetest.txt');
|
|
foreach ($file as $line => $text) {
|
|
echo "línea número $line: $text";
|
|
}
|
|
} catch (Exception $e) {
|
|
echo 'La operación Phar ha fallado: ', $e;
|
|
}
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs;
|
|
<screen>
|
|
<![CDATA[
|
|
línea número 1: hola
|
|
línea número 2: mi
|
|
línea número 3: amigo
|
|
línea número 1: hola
|
|
línea número 2: mi
|
|
línea número 3: amigo
|
|
]]>
|
|
</screen>
|
|
</example>
|
|
</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
|
|
-->
|