mirror of
https://github.com/php/doc-es.git
synced 2026-03-24 15:32:36 +01:00
146 lines
4.0 KiB
XML
146 lines
4.0 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- EN-Revision: c49274b06187db6cf96df8a48e5a3b92d1b56b16 Maintainer: PhilDaiguille Status: ready -->
|
|
<!-- Reviewed: yes -->
|
|
|
|
<refentry xml:id="function.stream-context-create" xmlns="http://docbook.org/ns/docbook">
|
|
<refnamediv>
|
|
<refname>stream_context_create</refname>
|
|
<refpurpose>Crea un contexto de flujo</refpurpose>
|
|
</refnamediv>
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type>resource</type><methodname>stream_context_create</methodname>
|
|
<methodparam choice="opt"><type class="union"><type>array</type><type>null</type></type><parameter>options</parameter><initializer>&null;</initializer></methodparam>
|
|
<methodparam choice="opt"><type class="union"><type>array</type><type>null</type></type><parameter>params</parameter><initializer>&null;</initializer></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Crea y devuelve un contexto de flujo, con los parámetros proporcionados
|
|
por <parameter>options</parameter>.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>options</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Debe ser un array asociativo, en el formato
|
|
<literal>$arr['wrapper']['option'] = $value</literal> o &null;.
|
|
Consulte las <link linkend="context">opciones de contexto</link>
|
|
para obtener una lista de las envolturas y opciones disponibles.
|
|
</para>
|
|
<para>
|
|
Por omisión &null;.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>params</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Debe ser un array asociativo
|
|
de formato <literal>$arr['parameter'] = $value</literal> o &null;.
|
|
Consulte la documentación sobre los
|
|
<link linkend="context.params">parámetros de contexto</link> para obtener una lista
|
|
de los parámetros de flujo estándar.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Un recurso que representa el contexto del flujo.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="changelog">
|
|
&reftitle.changelog;
|
|
<informaltable>
|
|
<tgroup cols="2">
|
|
<thead>
|
|
<row>
|
|
<entry>&Version;</entry>
|
|
<entry>&Description;</entry>
|
|
</row>
|
|
</thead>
|
|
<tbody>
|
|
<row>
|
|
<entry>8.0.0</entry>
|
|
<entry>
|
|
<parameter>options</parameter> y <parameter>params</parameter> ahora son nullable.
|
|
</entry>
|
|
</row>
|
|
</tbody>
|
|
</tgroup>
|
|
</informaltable>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<example>
|
|
<title>Ejemplo con <function>stream_context_create</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
|
|
$opts = [
|
|
'http' => [
|
|
'method' => "GET",
|
|
// Utilice CRLF \r\n para separar múltiples encabezados
|
|
'header' => "Accept-language: en\r\n" .
|
|
"Cookie: foo=bar",
|
|
]
|
|
];
|
|
|
|
$context = stream_context_create($opts);
|
|
|
|
/* Envía una petición HTTP a www.example.com
|
|
con los encabezados adicionales anteriores */
|
|
$fp = fopen('http://www.example.com', 'r', false, $context);
|
|
fpassthru($fp);
|
|
fclose($fp);
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<simplelist>
|
|
<member><function>stream_context_set_option</function></member>
|
|
<member>La lista de gestores (<xref linkend="wrappers"/>)</member>
|
|
<member>Las opciones de contexto (<xref linkend="context"/>)</member>
|
|
</simplelist>
|
|
</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
|
|
-->
|