mirror of
https://github.com/php/doc-ru.git
synced 2026-03-24 15:52:13 +01:00
183 lines
5.7 KiB
XML
183 lines
5.7 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
||
<!-- EN-Revision: a6afc9550480ad7aba8ab72d0286bd1b9ff41b04 Maintainer: tmn Status: ready -->
|
||
<!-- Reviewed: no -->
|
||
|
||
<refentry xml:id="streamwrapper.stream-open" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||
<refnamediv>
|
||
<refname>streamWrapper::stream_open</refname>
|
||
<refpurpose>Открывает файл или URL</refpurpose>
|
||
</refnamediv>
|
||
|
||
<refsect1 role="description">
|
||
&reftitle.description;
|
||
<methodsynopsis>
|
||
<modifier>public</modifier> <type>bool</type><methodname>streamWrapper::stream_open</methodname>
|
||
<methodparam><type>string</type><parameter>path</parameter></methodparam>
|
||
<methodparam><type>string</type><parameter>mode</parameter></methodparam>
|
||
<methodparam><type>int</type><parameter>options</parameter></methodparam>
|
||
<methodparam><type class="union"><type>string</type><type>null</type></type><parameter role="reference">opened_path</parameter></methodparam>
|
||
</methodsynopsis>
|
||
<para>
|
||
Этот метод вызывается сразу после инициализации обёртки (например,
|
||
<function>fopen</function> и <function>file_get_contents</function>).
|
||
</para>
|
||
</refsect1>
|
||
|
||
<refsect1 role="parameters">
|
||
&reftitle.parameters;
|
||
<para>
|
||
<variablelist>
|
||
<varlistentry>
|
||
<term><parameter>path</parameter></term>
|
||
<listitem>
|
||
<para>
|
||
Задаёт URL, который будет передан в вызывающую функцию.
|
||
</para>
|
||
<note>
|
||
<para>
|
||
URL можно разделить на части функцией <function>parse_url</function>.
|
||
URL должен быть отделен символами ://.
|
||
Символы : и :/ пока работают, но дальнейшая поддержка не гарантируется.
|
||
</para>
|
||
</note>
|
||
</listitem>
|
||
</varlistentry>
|
||
<varlistentry>
|
||
<term><parameter>mode</parameter></term>
|
||
<listitem>
|
||
<para>
|
||
Режим открытия файла, аналогичен режимам для
|
||
<function>fopen</function>.
|
||
</para>
|
||
<note>
|
||
<para>
|
||
Не забывайте проверять, поддерживается ли режим
|
||
<parameter>mode</parameter> файлом
|
||
<parameter>path</parameter>.
|
||
</para>
|
||
</note>
|
||
</listitem>
|
||
</varlistentry>
|
||
<varlistentry>
|
||
<term><parameter>options</parameter></term>
|
||
<listitem>
|
||
<para>
|
||
Хранит дополнительные флаги, задаваемые API потоков. Может содержать одно
|
||
или несколько значений, объединённых операцией ИЛИ. Значения приведены ниже.
|
||
<informaltable>
|
||
<tgroup cols="2">
|
||
<thead>
|
||
<row>
|
||
<entry>Флаг</entry>
|
||
<entry>Описание</entry>
|
||
</row>
|
||
</thead>
|
||
<tbody>
|
||
<row>
|
||
<entry><constant>STREAM_USE_PATH</constant></entry>
|
||
<entry>Если путь <parameter>path</parameter> относительный, требуется
|
||
искать ресурс, используя include_path.
|
||
</entry>
|
||
</row>
|
||
<row>
|
||
<entry><constant>STREAM_REPORT_ERRORS</constant></entry>
|
||
<entry>Если этот флаг задан, Вы можете вызывать ошибки
|
||
функцией <function>trigger_error</function> во время
|
||
открытия потока. Если флаг не задан, ошибки вызывать нельзя.
|
||
</entry>
|
||
</row>
|
||
</tbody>
|
||
</tgroup>
|
||
</informaltable>
|
||
</para>
|
||
</listitem>
|
||
</varlistentry>
|
||
<varlistentry>
|
||
<term><parameter>opened_path</parameter></term>
|
||
<listitem>
|
||
<para>
|
||
Если <parameter>path</parameter> успешно открыт, и
|
||
<constant>STREAM_USE_PATH</constant> задана в <parameter>options</parameter>,
|
||
то в аргументе <parameter>opened_path</parameter> необходимо сохранить
|
||
полный путь к открытому файлу или ресурсу.
|
||
</para>
|
||
</listitem>
|
||
</varlistentry>
|
||
</variablelist>
|
||
</para>
|
||
</refsect1>
|
||
|
||
<refsect1 role="returnvalues">
|
||
&reftitle.returnvalues;
|
||
<para>
|
||
&return.success;
|
||
</para>
|
||
</refsect1>
|
||
|
||
<refsect1 role="errors"><!-- {{{ -->
|
||
&reftitle.errors;
|
||
&userstream.not.implemented.warning;
|
||
</refsect1><!-- }}} -->
|
||
|
||
|
||
<!-- {{{
|
||
<refsect1 role="examples">
|
||
&reftitle.examples;
|
||
<para>
|
||
<example>
|
||
<title><function>streamWrapper::stream_open</function> example</title>
|
||
<programlisting role="php">
|
||
<![CDATA[
|
||
<?php
|
||
/* ... */
|
||
?>
|
||
]]>
|
||
</programlisting>
|
||
&example.outputs.similar;
|
||
<screen>
|
||
<![CDATA[
|
||
...
|
||
]]>
|
||
</screen>
|
||
</example>
|
||
</para>
|
||
</refsect1>
|
||
}}}-->
|
||
|
||
<refsect1 role="notes"><!-- {{{ -->
|
||
&reftitle.notes;
|
||
&userstream.updates.context;
|
||
</refsect1><!-- }}} -->
|
||
|
||
<refsect1 role="seealso">
|
||
&reftitle.seealso;
|
||
<para>
|
||
<simplelist>
|
||
<member><function>fopen</function></member>
|
||
<member><function>parse_url</function></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
|
||
-->
|