php-doc-en/reference/stream/functions/stream-get-meta-data.xml

198 lines
5.5 KiB
XML
Raw Normal View History

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.12 $ -->
<refentry xml:id="function.stream-get-meta-data" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>stream_get_meta_data</refname>
<refpurpose>Retrieves header/meta data from streams/file pointers</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>array</type><methodname>stream_get_meta_data</methodname>
<methodparam><type>resource</type><parameter>stream</parameter></methodparam>
</methodsynopsis>
<para>
Returns information about an existing <parameter>stream</parameter>.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>stream</parameter></term>
<listitem>
<para>
The stream can be any stream created by <function>fopen</function>,
<function>fsockopen</function> and <function>pfsockopen</function>.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
The result array contains the following items:
</para>
<itemizedlist>
<listitem>
<para>
<literal>timed_out</literal> (bool) - &true; if the stream
timed out while waiting for data on the last call to
<function>fread</function> or <function>fgets</function>.
</para>
</listitem>
<listitem>
<para>
<literal>blocked</literal> (bool) - &true; if the stream is
in blocking IO mode. See <function>stream_set_blocking</function>.
</para>
</listitem>
<listitem>
<para>
<literal>eof</literal> (bool) - &true; if the stream has reached
end-of-file. Note that for socket streams this member can be &true;
even when <literal>unread_bytes</literal> is non-zero. To
determine if there is more data to be read, use
<function>feof</function> instead of reading this item.
</para>
</listitem>
<listitem>
<para>
<literal>unread_bytes</literal> (int) - the number of bytes
currently contained in the PHP's own internal buffer.
</para>
<note>
<simpara>
You shouldn't use this value in a script.
</simpara>
</note>
</listitem>
<listitem>
<para>
<literal>stream_type</literal> (string) - a label describing
the underlying implementation of the stream.
</para>
</listitem>
<listitem>
<para>
<literal>wrapper_type</literal> (string) - a label describing
the protocol wrapper implementation layered over the stream.
See <xref linkend="wrappers"/> for more information about wrappers.
</para>
</listitem>
<listitem>
<para>
<literal>wrapper_data</literal> (mixed) - wrapper specific
data attached to this stream. See <xref linkend="wrappers"/> for
more information about wrappers and their wrapper data.
</para>
</listitem>
<listitem>
<para>
<literal>filters</literal> (array) - and array containing
the names of any filters that have been stacked onto this stream.
Documentation on filters can be found in the
<link linkend="filters">Filters appendix</link>.
</para>
</listitem>
<listitem>
<para>
<literal>mode</literal> (string) - the type of access required for
this stream (see Table 1 of the <link
linkend="function.fopen">fopen()</link> reference)
</para>
</listitem>
<listitem>
<para>
<literal>seekable</literal> (bool) - whether the current stream can
be seeked.
</para>
</listitem>
<listitem>
<para>
<literal>uri</literal> (string) - the URI/filename associated with this
stream.
</para>
</listitem>
</itemizedlist>
</refsect1>
<refsect1 role="changelog">
&reftitle.changelog;
<para>
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>&Version;</entry>
<entry>&Description;</entry>
</row>
</thead>
<tbody>
<row>
<entry>5.0.0</entry>
<entry>
The following entries were added in the returned array:
<literal>mode</literal>, <literal>seekable</literal>,
and <literal>uri</literal>.
</entry>
</row>
<row>
<entry>4.3.0</entry>
<entry>
The following entries were added in the returned array:
<literal>stream_type</literal>, <literal>wrapper_type</literal>,
<literal>wrapper_data</literal>, and <literal>filters</literal>.
</entry>
</row>
<row>
<entry>4.3.0</entry>
<entry>
<function>socket_get_status</function> is an alias for this function.
Prior to PHP 4.3.0, it was used to retrieve the first four items, for
<emphasis>socket based streams only</emphasis>.
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</para>
</refsect1>
<refsect1 role="notes">
&reftitle.notes;
<note>
<para>This function does NOT work on sockets created by the <link
linkend="ref.sockets">Socket extension</link>.
</para>
</note>
</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:"../../../../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
-->