mirror of
https://github.com/php/doc-ja.git
synced 2026-03-24 15:12:22 +01:00
145 lines
4.3 KiB
XML
145 lines
4.3 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!-- $Revision$ -->
|
|
<!-- EN-Revision: c49274b06187db6cf96df8a48e5a3b92d1b56b16 Maintainer: hirokawa Status: ready -->
|
|
<!-- Credits: mumumu -->
|
|
<refentry xml:id="function.stream-context-create" xmlns="http://docbook.org/ns/docbook">
|
|
<refnamediv>
|
|
<refname>stream_context_create</refname>
|
|
<refpurpose>ストリームコンテキストを作成する</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>
|
|
<parameter>options</parameter> に、
|
|
指定されたオプションが予め設定されたストリームコンテキストを作成し、
|
|
それを返します。
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>options</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
次のような形式の連想配列からなる連想配列
|
|
<literal>$arr['wrapper']['option'] = $value</literal>
|
|
または &null; でなくてはなりません。
|
|
使用可能はラッパーやオプションの一覧は <link linkend="context">コンテキストオプション</link> を参照ください。
|
|
</para>
|
|
<para>
|
|
デフォルトは &null; です。
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>params</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
<literal>$arr['parameter'] = $value</literal>
|
|
形式の連想配列、または &null; でなくてはなりません。
|
|
標準のストリームパラメータについては
|
|
<link linkend="context.params">コンテキストパラメータ</link> を参照ください。
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
ストリームコンテキストリソースを返します。
|
|
</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> と
|
|
<parameter>params</parameter> は、nullable になりました。
|
|
</entry>
|
|
</row>
|
|
</tbody>
|
|
</tgroup>
|
|
</informaltable>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<example>
|
|
<title><function>stream_context_create</function> の使用</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$opts = [
|
|
'http' => [
|
|
'method' => "GET",
|
|
// 複数のヘッダを分けるのに CRLF \r\n を使います
|
|
'header' => "Accept-language: en\r\n" .
|
|
"Cookie: foo=bar",
|
|
]
|
|
];
|
|
|
|
$context = stream_context_create($opts);
|
|
|
|
/* 上のヘッダと共に http リクエストを www.example.com に対して
|
|
送出します */
|
|
$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>サポートするラッパーのリスト (<xref linkend="wrappers"/>)</member>
|
|
<member>コンテキストオプション (<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
|
|
-->
|