mirror of
https://github.com/php/doc-es.git
synced 2026-03-26 08:22:08 +01:00
git-svn-id: https://svn.php.net/repository/phpdoc/es/trunk@324604 c90b9560-bf6c-de11-be94-00142212c4b1
135 lines
3.8 KiB
XML
135 lines
3.8 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<!-- EN-Revision: f3aca6e5fd6dee9473aa034a1e2214daaf2ad070 Maintainer: seros Status: ready -->
|
|
<refentry xml:id="function.stream-context-get-default" xmlns="http://docbook.org/ns/docbook">
|
|
<refnamediv>
|
|
<refname>stream_context_get_default</refname>
|
|
<refpurpose>Recuperar el contexto de flujo predeterminado</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type>resource</type><methodname>stream_context_get_default</methodname>
|
|
<methodparam choice="opt"><type>array</type><parameter>options</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<simpara>
|
|
Devuelve el contexto de flujo predeterminado que es usado siempre que las operaciones con archivos
|
|
(<function>fopen</function>, <function>file_get_contents</function>, etc...)
|
|
son llamadas sin un parámetro de contexto. Las opciones para el contexto predeterminado
|
|
pueden ser especificadas opcionalmente con esta función usando la misma sintaxis que en
|
|
<function>stream_context_create</function>.
|
|
</simpara>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>options</parameter></term>
|
|
<listitem>
|
|
<simpara>
|
|
<parameter>options</parameter> debe ser una matriz
|
|
asociativa de matrices asociativas con el formato
|
|
<literal>$matriz['envoltura']['opción'] = $valor</literal>.
|
|
</simpara>
|
|
<note>
|
|
<para>
|
|
A partir de PHP 5.3.0, la función <function>stream_context_set_default</function>
|
|
se puede usar para establecer el contexto predeterminado.
|
|
</para>
|
|
</note>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Un <type>resource</type> de contexto de flujo.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example xml:id="stream-context-get-default.example.basic">
|
|
<title>Usar <function>stream_context_get_default</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$opc_pred = array(
|
|
'http'=>array(
|
|
'método'=>"GET",
|
|
'cabecera'=>"Accept-language: en\r\n" .
|
|
"Cookie: foo=bar",
|
|
'proxy'=>"tcp://10.54.1.39:8000"
|
|
)
|
|
);
|
|
|
|
|
|
$opc_alt = array(
|
|
'http'=>array(
|
|
'método'=>"POST",
|
|
'cabecera'=>"Content-type: application/x-www-form-urlencoded\r\n" .
|
|
"Content-length: " . strlen("baz=bomb"),
|
|
'contenido'=>"baz=bomb"
|
|
)
|
|
);
|
|
|
|
$predeterminado = stream_context_get_default($opc_pred);
|
|
$alternativo = stream_context_create($opc_alt);
|
|
|
|
/* Envía una petición GET normal al servidor proxy en 10.54.1.39
|
|
* Para www.example.com usar opciones de contexto especificadas en $opc_pred
|
|
*/
|
|
readfile('http://www.example.com');
|
|
|
|
/* Envía una petición POST directamente a www.example.com
|
|
* Usar opciones de contexto especificadas en $opc_alt
|
|
*/
|
|
readfile('http://www.example.com', false, $alternativo);
|
|
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso"><!-- {{{ -->
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><function>stream_context_create</function></member>
|
|
<member>Listado de envolturas soportadas con opciones de contexto (<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
|
|
-->
|