mirror of
https://github.com/php/doc-es.git
synced 2026-03-25 16:02:13 +01:00
git-svn-id: https://svn.php.net/repository/phpdoc/es/trunk@337499 c90b9560-bf6c-de11-be94-00142212c4b1
156 lines
4.3 KiB
XML
156 lines
4.3 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<!-- EN-Revision: 97efe1821f47c4e52817caf575c8034f2f5f4e5d Maintainer: seros Status: ready -->
|
|
<!-- Reviewed: yes Maintainer: seros -->
|
|
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.readfile">
|
|
<refnamediv>
|
|
<refname>readfile</refname>
|
|
<refpurpose>Realizar la salida de un fichero</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>readfile</methodname>
|
|
<methodparam><type>string</type><parameter>filename</parameter></methodparam>
|
|
<methodparam choice="opt"><type>bool</type><parameter>use_include_path</parameter><initializer>false</initializer></methodparam>
|
|
<methodparam choice="opt"><type>resource</type><parameter>context</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Lee un fichero y lo escribe en el búfer de salida.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>filename</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
El nombre del fichero a leer.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>use_include_path</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Se puede emplear el segundo parámetro opcional y establecerlo a &true; si se
|
|
desea buscar también el fichero en <link
|
|
linkend="ini.include-path">include_path</link>.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>context</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Un <type>resource</type> de flujos de contexto.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Devuelve el número de bytes leídos del fichero. Si se produjo un
|
|
error, devuelve &false; y, a menos que la función fuese llamada como
|
|
@<function>readfile</function>, se imprime un mensaje de error.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title>Forzar un descarga empleando <function>readfile</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$fichero = 'mono.gif';
|
|
|
|
if (file_exists($fichero)) {
|
|
header('Content-Description: File Transfer');
|
|
header('Content-Type: application/octet-stream');
|
|
header('Content-Disposition: attachment; filename="'.basename($fichero).'"');
|
|
header('Expires: 0');
|
|
header('Cache-Control: must-revalidate');
|
|
header('Pragma: public');
|
|
header('Content-Length: ' . filesize($fichero));
|
|
readfile($fichero);
|
|
exit;
|
|
}
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs.similar;
|
|
<mediaobject>
|
|
<alt>Diálogo de Abrir / Guardar</alt>
|
|
<imageobject>
|
|
<imagedata fileref="en/reference/filesystem/figures/readfile.png"/>
|
|
</imageobject>
|
|
</mediaobject>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="notes">
|
|
&reftitle.notes;
|
|
|
|
<note>
|
|
<para>
|
|
<function>readfile</function> no presentará problemas de memoria,
|
|
incluso al enviar ficheros grandes, por sí sola. Si se encuentra un
|
|
error de memoria insuficiente asegúrese que el búfer de salida está desactivado con
|
|
<function>ob_get_level</function>.
|
|
</para>
|
|
</note>
|
|
|
|
&tip.fopen-wrapper;
|
|
¬e.context-support;
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><function>fpassthru</function></member>
|
|
<member><function>file</function></member>
|
|
<member><function>fopen</function></member>
|
|
<member><function>include</function></member>
|
|
<member><function>require</function></member>
|
|
<member><function>virtual</function></member>
|
|
<member><function>file_get_contents</function></member>
|
|
<member><xref linkend="wrappers"/></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
|
|
-->
|