1
0
mirror of https://github.com/php/doc-ja.git synced 2026-03-24 15:12:22 +01:00
Files
siwa32 3690cd32b3 PHP 8.4: CSV related changes and deprecations の翻訳 (#250)
* PHP 8.4: CSV related changes and deprecations の取り込み

https://github.com/php/doc-en/pull/4093

以下も合わせて取り込む

reference/spl/splfileobject/setcsvcontrol.xml
- [skip-revcheck] Fill xi:fallback to avoid 'variablelist incomplete' in some translations
  - https://github.com/php/doc-en/pull/4128
- Update setcsvcontrol.xml Fix typo
  - https://github.com/php/doc-en/pull/4379

reference/spl/splfileobject/fgetcsv.xml
- Update fgetcsv.xml Remove the duplicate sentence
  - https://github.com/php/doc-en/pull/4111

* Fix GH-4175: do not say the parameters are optional の取り込み

https://github.com/php/doc-en/pull/4177

* Document str_getcsv() and fgetcsv() change in 8.3.0 (closes #4197) の取り込み

https://github.com/php/doc-en/pull/4198

* Fix: Add explicit $escape parameter in fputcsv for PHP 8.4 compatibility の取り込み

https://github.com/php/doc-en/pull/4283

* 改行位置を原文と合わせる対応

---------

Co-authored-by: 武田 憲太郎 <takeda@youmind.jp>
2025-01-19 11:40:13 +09:00

182 lines
5.9 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: 73007ad9889ca2a3d85b0a710b55deb44ac370cc Maintainer: takagi Status: ready -->
<!-- Credits: mumumu -->
<refentry xml:id="splfileobject.fputcsv" xmlns="http://docbook.org/ns/docbook" xmlns:xi="http://www.w3.org/2001/XInclude">
<refnamediv>
<refname>SplFileObject::fputcsv</refname>
<refpurpose>フィールドの配列を CSV の行として書き出す</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis role="SplFileObject">
<modifier>public</modifier> <type class="union"><type>int</type><type>false</type></type><methodname>SplFileObject::fputcsv</methodname>
<methodparam><type>array</type><parameter>fields</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>separator</parameter><initializer>","</initializer></methodparam>
<methodparam choice="opt"><type>string</type><parameter>enclosure</parameter><initializer>"\""</initializer></methodparam>
<methodparam choice="opt"><type>string</type><parameter>escape</parameter><initializer>"\\"</initializer></methodparam>
<methodparam choice="opt"><type>string</type><parameter>eol</parameter><initializer>"\n"</initializer></methodparam>
</methodsynopsis>
<para>
<parameter>fields</parameter> の配列を、<acronym>CSV</acronym>
の行としてファイルに書き出します。
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>fields</parameter></term>
<listitem>
<para>
値の配列。
</para>
</listitem>
</varlistentry>
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('splfileobject.fgetcsv')/db:refsect1[@role='parameters']//db:varlistentry[db:term[db:parameter[text()='separator']]]/.)">
<xi:fallback/>
</xi:include>
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('splfileobject.fgetcsv')/db:refsect1[@role='parameters']//db:varlistentry[db:term[db:parameter[text()='enclosure']]]/.)">
<xi:fallback/>
</xi:include>
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('splfileobject.fgetcsv')/db:refsect1[@role='parameters']//db:varlistentry[db:term[db:parameter[text()='escape']]]/.)">
<xi:fallback/>
</xi:include>
<varlistentry>
<term><parameter>eol</parameter></term>
<listitem>
<para>
<parameter>eol</parameter> は、
カスタムの行末シーケンスを設定するオプションの引数です。
</para>
</listitem>
</varlistentry>
</variablelist>
&warning.csv.escape-parameter;
<note>
<para>
<parameter>enclosure</parameter> がフィールド内に含まれる場合は、同じ文字を二度続けることでエスケープします。
ただし、その直前に <parameter>escape</parameter> がある場合は別です。
</para>
</note>
&warning.csv.escape-parameter;
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
書き出した文字列の長さを返します。&return.falseforfailure;
</para>
</refsect1>
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('function.fgetcsv')/db:refsect1[@role='errors']/.)">
<xi:fallback/>
</xi:include>
<refsect1 role="changelog">
&reftitle.changelog;
<para>
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>&Version;</entry>
<entry>&Description;</entry>
</row>
</thead>
<tbody>
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('function.fgetcsv')/db:refsect1[@role='changelog']//db:row[db:entry[text()='8.4.0']]/.)">
<xi:fallback/>
</xi:include>
<row>
<entry>8.1.0</entry>
<entry>
オプションの引数 <parameter>eol</parameter> が追加されました。
</entry>
</row>
<row>
<entry>7.4.0</entry>
<entry>
<parameter>escape</parameter> パラメータは空文字列を受け入れるようになりました。
この場合、(RFC 4180 に準拠していない) 独自仕様のエスケープ機構が無効になります。
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example xml:id="splfileobject.fputcsv.examples.basic">
<title><methodname>SplFileObject::fputcsv</methodname> の例</title>
<programlisting role="php">
<![CDATA[
<?php
$list = array (
array('aaa', 'bbb', 'ccc', 'dddd'),
array('123', '456', '789'),
array('"aaa"', '"bbb"')
);
$file = new SplFileObject('file.csv', 'w');
foreach ($list as $fields) {
$file->fputcsv($fields);
}
?>
]]>
</programlisting>
<para>上の例は、次の内容をファイル <literal>file.csv</literal> に書き出します。</para>
<screen>
<![CDATA[
aaa,bbb,ccc,dddd
123,456,789
"""aaa""","""bbb"""
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member><methodname>SplFileObject::fgetcsv</methodname></member>
<member><methodname>SplFileObject::setCsvControl</methodname></member>
<member><methodname>SplFileObject::getCsvControl</methodname></member>
<member><function>fputcsv</function></member>
<member><function>fgetcsv</function></member>
<member><function>str_getcsv</function></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
-->