mirror of
https://github.com/php/doc-es.git
synced 2026-03-26 08:22:08 +01:00
git-svn-id: https://svn.php.net/repository/phpdoc/es/trunk@330803 c90b9560-bf6c-de11-be94-00142212c4b1
118 lines
3.3 KiB
XML
118 lines
3.3 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<!-- EN-Revision: 656d1610af1a960d87c8b7056e54d0d4c75fb123 Maintainer: seros Status: ready -->
|
|
<!-- Reviewed: no -->
|
|
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="pharfileinfo.construct">
|
|
<refnamediv>
|
|
<refname>PharFileInfo::__construct</refname>
|
|
<refpurpose>Construir un objeto de entrada Phar</refpurpose>
|
|
</refnamediv>
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<modifier>public</modifier> <methodname>PharFileInfo::__construct</methodname>
|
|
<methodparam><type>string</type><parameter>entry</parameter></methodparam>
|
|
</methodsynopsis>
|
|
|
|
<para>
|
|
Este método no debería llamarse directamente. En su lugar, un objeto de la clase PharFileInfo
|
|
se inicializa al llamar a <function>Phar::offsetGet</function>
|
|
a traves del acceso a un array.
|
|
</para>
|
|
|
|
</refsect1>
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>entry</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
La URL completa para recuperar un fichero. Si se desea recuperar la informacion
|
|
del fichoer <literal>mi/fichero.php</literal> desde el phar <literal>boo.phar</literal>,
|
|
la entrada debería ser <literal>phar://boo.phar/mi/fichero.php</literal>.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="errors">
|
|
&reftitle.errors;
|
|
<para>
|
|
Lanza una excepción de tipo <classname>BadMethodCallException</classname> si
|
|
<link linkend="object.construct">__construct()</link> es llamado dos veces.
|
|
Lanza una excepción de tipo <classname>UnexpectedValueException</classname> si
|
|
la URL del phar solicitado está malformada, el phar solicitado
|
|
no se puede abrir, o el fichero no se puede encontrar dentro del phar.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title>Un ejemplo de <function>PharFileInfo::__construct</function></title>
|
|
<para>
|
|
</para>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
try {
|
|
$p = new Phar('/ruta/a/mi.phar', 0, 'mi.phar');
|
|
$p['fichero_prueba.txt'] = "hola\nqué tal\namigo";
|
|
$fichero = $p['fichero_prueba.txt'];
|
|
foreach ($fichero as $línea => $texto) {
|
|
echo "línea número $línea: $texto";
|
|
}
|
|
// esto también funciona
|
|
$fichero = new PharFileInfo('phar:///ruta/a/mi.phar/fichero_prueba.txt');
|
|
foreach ($fichero as $línea => $texto) {
|
|
echo "línea número $línea: $texto";
|
|
}
|
|
} catch (Exception $e) {
|
|
echo 'Las operaciones Phar fallaron: ', $e;
|
|
}
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs;
|
|
<screen>
|
|
<![CDATA[
|
|
línea número 1: hola
|
|
línea número 2: qué tal
|
|
línea número 3: amigo
|
|
línea número 1: hola
|
|
línea número 2: qué tal
|
|
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
|
|
-->
|