mirror of
https://github.com/php/doc-es.git
synced 2026-03-24 07:22:16 +01:00
105 lines
3.3 KiB
XML
105 lines
3.3 KiB
XML
<?xml version='1.0' encoding='utf-8'?>
|
|
<!-- EN-Revision: f03806fcd8fe03a0501bd40b6e3939ff6589a1d2 Maintainer: PhilDaiguille Status: ready -->
|
|
<!-- Reviewed: yes -->
|
|
<refentry xml:id="phar.interceptfilefuncs" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
<refnamediv>
|
|
<refname>Phar::interceptFileFuncs</refname>
|
|
<refpurpose>Indica a phar que debe interceptar las funciones de archivos</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis role="Phar">
|
|
<modifier>final</modifier> <modifier>public</modifier> <modifier>static</modifier> <type>void</type><methodname>Phar::interceptFileFuncs</methodname>
|
|
<void/>
|
|
</methodsynopsis>
|
|
<para>
|
|
Indica a phar que debe interceptar <function>fopen</function>, <function>readfile</function>,
|
|
<function>file_get_contents</function>, <function>opendir</function> y todas las funciones
|
|
relativas a stat. Si cualquiera de estas funciones es llamada desde el archivo phar
|
|
con una ruta relativa, la llamada es modificada para acceder a un archivo dentro del archivo.
|
|
Las rutas absolutas se asumen como intentos de carga de archivos externos
|
|
desde el sistema de archivos.
|
|
</para>
|
|
<para>
|
|
Esta función permite la ejecución de aplicaciones PHP diseñadas
|
|
para ser lanzadas fuera de un disco duro, como aplicación phar.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
No se proporcionan argumentos.
|
|
</para>
|
|
|
|
</refsect1>
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title>Ejemplo con <function>Phar::interceptFileFuncs</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
Phar::interceptFileFuncs();
|
|
include 'phar://' . __FILE__ . '/fichero.php';
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
<para>
|
|
Suponiendo que este phar se llama <literal>/ruta/hacia/monphar.phar</literal> y contiene
|
|
<literal>fichero.php</literal> y
|
|
<literal>fichero2.txt</literal>, si <literal>fichero.php</literal> contiene este código:
|
|
</para>
|
|
<para>
|
|
<example>
|
|
<title>Un ejemplo con <function>Phar::interceptFileFuncs</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
echo file_get_contents('fichero2.txt');
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
<para>
|
|
Normalmente, PHP buscaría en el directorio actual el archivo llamado <literal>file2.txt</literal>,
|
|
es decir, en el directorio de fichero.php o el directorio actual del usuario de la línea
|
|
de comandos. <function>Phar::interceptFileFuncs</function> indica
|
|
a PHP que considere <literal>phar:///ruta/hacia/monphar.phar/</literal> como directorio actual
|
|
y así abre en el ejemplo anterior el archivo <literal>phar:///ruta/hacia/monphar.phar/fichero2.txt</literal>.
|
|
</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
|
|
-->
|